"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
lib/bucket: fix tidying of // in object keys #5858
Nick Craig-Woodfe19184084d9
diff --git a/lib/bucket/bucket.go b/lib/bucket/bucket.goindex 9b0b31afd..4fffb4d79 100644--- a/lib/bucket/bucket.go+++ b/lib/bucket/bucket.go@@ -31,7 +31,9 @@ func Split(absPath string) (bucket, bucketPath string) {// Join path1 and path2//-// Like path.Join but does not clean the path - useful to preserve trailing /+// Like path.Join but does not clean the path - useful to preserve trailing /.+//+// It also does not clean multiple // in the path.func Join(path1, path2 string) string {if path1 == "" {return path2@@ -39,7 +41,7 @@ func Join(path1, path2 string) string {if path2 == "" {return path1}- return strings.TrimSuffix(path1, "/") + "/" + strings.TrimPrefix(path2, "/")+ return path1 + "/" + path2}// IsAllSlashes returns true if s is all / characters.diff --git a/lib/bucket/bucket_test.go b/lib/bucket/bucket_test.goindex df4b7d95b..3dab9e846 100644--- a/lib/bucket/bucket_test.go+++ b/lib/bucket/bucket_test.go@@ -34,10 +34,10 @@ func TestJoin(t *testing.T) {{in1: "in1", in2: "", want: "in1"},{in1: "", in2: "in2", want: "in2"},{in1: "in1", in2: "in2", want: "in1/in2"},- {in1: "in1/", in2: "in2", want: "in1/in2"},- {in1: "in1", in2: "/in2", want: "in1/in2"},+ {in1: "in1/", in2: "in2", want: "in1//in2"},+ {in1: "in1", in2: "/in2", want: "in1//in2"},{in1: "in1", in2: "in2/", want: "in1/in2/"},- {in1: "/in1", in2: "/in2", want: "/in1/in2"},+ {in1: "/in1", in2: "/in2", want: "/in1//in2"},{in1: "/in1", in2: "../in2", want: "/in1/../in2"},} {got := Join(test.in1, test.in2)