"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
premiumizeme: fix uploading files with ";" in their names
Nick Craig-Wood7c18e1eb869d
diff --git a/backend/premiumizeme/premiumizeme.go b/backend/premiumizeme/premiumizeme.goindex 3991d19ee..7100cf479 100644--- a/backend/premiumizeme/premiumizeme.go+++ b/backend/premiumizeme/premiumizeme.go@@ -993,6 +993,13 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op}()}+ // The upload server truncates the file name at the first ";" so+ // upload under a temporary name and rename it afterwards.+ uploadLeaf := leaf+ if strings.Contains(leaf, ";") {+ uploadLeaf = "rclone-upload-" + random.String(16)+ }+opts = rest.Opts{Method: "POST",RootURL: info.URL,@@ -1000,8 +1007,8 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, opMultipartParams: url.Values{"token": {info.Token},},- MultipartContentName: "file", // ..name of the parameter which is the attached file- MultipartFileName: leaf, // ..name of the file for the attached file+ MultipartContentName: "file", // ..name of the parameter which is the attached file+ MultipartFileName: uploadLeaf, // ..name of the file for the attached fileContentLength: &size,}var result api.Response@@ -1016,6 +1023,29 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, opreturn fmt.Errorf("upload file: %w", err)}+ if uploadLeaf != leaf {+ var newID string+ var found bool+ _, found, err = o.fs.listAll(ctx, directoryID, false, true, func(item *api.Item) bool {+ if item.Name == uploadLeaf {+ newID = item.ID+ return true+ }+ return false+ })+ if err != nil {+ return fmt.Errorf("upload find temporary file: %w", err)+ }+ if !found {+ return fmt.Errorf("upload find temporary file %q: %w", uploadLeaf, fs.ErrorObjectNotFound)+ }+ err = o.fs.renameLeaf(ctx, true, newID, leaf)+ if err != nil {+ _ = o.fs.remove(ctx, newID)+ return fmt.Errorf("upload rename temporary file: %w", err)+ }+ }+// on successful upload, remove old file if it existsuploaded = trueif o.hasMetaData {