From 776b7a4bbe3aafbcc717b7f334290c068eab9d82 Mon Sep 17 00:00:00 2001 From: nostalume Date: Sat, 12 Sep 2026 10:20:46 +0800 Subject: [PATCH] test(s3): encode multipart fixture paths - Serialize the Local storage addition instead of interpolating filesystem paths into JSON. - Keep multipart fixture behavior portable across Windows and Linux. Co-authored-by: Codex <267193182+codex@users.noreply.github.com> --- server/s3/multipart_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/s3/multipart_test.go b/server/s3/multipart_test.go index 7adc4c5e3b..a7349583d1 100644 --- a/server/s3/multipart_test.go +++ b/server/s3/multipart_test.go @@ -3,6 +3,7 @@ package s3 import ( "bytes" "context" + "encoding/json" "errors" "os" "path/filepath" @@ -67,11 +68,21 @@ func setupMultipartBackend(t *testing.T) (*s3Backend, string) { t.Fatalf("mkdir local root: %v", err) } t.Cleanup(func() { _ = os.RemoveAll(localRoot) }) + addition, err := json.Marshal(struct { + RootFolderPath string `json:"root_folder_path"` + Thumbnail bool `json:"thumbnail"` + }{ + RootFolderPath: localRoot, + Thumbnail: false, + }) + if err != nil { + t.Fatalf("marshal local storage addition: %v", err) + } _, err = op.CreateStorage(ctx, model.Storage{ Driver: "Local", MountPath: mount, - Addition: `{"root_folder_path":"` + localRoot + `","thumbnail":false}`, + Addition: string(addition), }) if err != nil { t.Fatalf("create local storage: %+v", err)