"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
swift: Fix extra HEAD transaction when uploading a new file - fixes #2053
Nick Craig-Wood5055b340da91
diff --git a/backend/swift/swift.go b/backend/swift/swift.goindex acd66df40..5c229e4ea 100644--- a/backend/swift/swift.go+++ b/backend/swift/swift.go@@ -145,10 +145,10 @@ type Fs struct {//// Will definitely have info but maybe not metatype Object struct {- fs *Fs // what this object is part of- remote string // The remote path- info swift.Object // Info from the swift object if known- headers *swift.Headers // The object headers if known+ fs *Fs // what this object is part of+ remote string // The remote path+ info swift.Object // Info from the swift object if known+ headers swift.Headers // The object headers if known}// ------------------------------------------------------------@@ -491,8 +491,9 @@ func (f *Fs) ListR(dir string, callback fs.ListRCallback) (err error) {func (f *Fs) Put(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {// Temporary Object under constructionfs := &Object{- fs: f,- remote: src.Remote(),+ fs: f,+ remote: src.Remote(),+ headers: swift.Headers{}, // Empty object headers to stop readMetaData being called}return fs, fs.Update(in, src, options...)}@@ -657,7 +658,7 @@ func (o *Object) hasHeader(header string) (bool, error) {}return false, err}- _, isDynamicLargeObject := (*o.headers)[header]+ _, isDynamicLargeObject := o.headers[header]return isDynamicLargeObject, nil}@@ -693,7 +694,7 @@ func (o *Object) readMetaData() (err error) {return err}o.info = info- o.headers = &h+ o.headers = hreturn nil}@@ -726,10 +727,10 @@ func (o *Object) SetModTime(modTime time.Time) error {meta.SetModTime(modTime)newHeaders := meta.ObjectHeaders()for k, v := range newHeaders {- (*o.headers)[k] = v+ o.headers[k] = v}// Include any other metadata from request- for k, v := range *o.headers {+ for k, v := range o.headers {if strings.HasPrefix(k, "X-Object-") {newHeaders[k] = v}