"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: use Content-Length on uploads - fixes #125
Nick Craig-Wood95fd79faf961
diff --git a/swift/swift.go b/swift/swift.goindex 92a9ff22f..6c4d55852 100644--- a/swift/swift.go+++ b/swift/swift.go@@ -8,6 +8,7 @@ import ("io""path""regexp"+ "strconv""strings""time"@@ -558,6 +559,7 @@ func (o *FsObjectSwift) updateChunks(in io.Reader, headers swift.Headers, size isegmentsPath := fmt.Sprintf("%s%s/%s", o.swift.root, o.remote, uniquePrefix)for left > 0 {n := min(left, int64(chunkSize))+ headers["Content-Length"] = strconv.FormatInt(n, 10) // set Content-Length as we know itsegmentReader := io.LimitReader(in, n)segmentPath := fmt.Sprintf("%s/%08d", segmentsPath, i)fs.Debug(o, "Uploading segment file %q into %q", segmentPath, o.swift.segmentsContainer)@@ -570,6 +572,7 @@ func (o *FsObjectSwift) updateChunks(in io.Reader, headers swift.Headers, size i}// Upload the manifestheaders["X-Object-Manifest"] = fmt.Sprintf("%s/%s", o.swift.segmentsContainer, segmentsPath)+ headers["Content-Length"] = "0" // set Content-Length as we know itemptyReader := bytes.NewReader(nil)manifestName := o.swift.root + o.remote_, err = o.swift.c.ObjectPut(o.swift.container, manifestName, emptyReader, true, "", "", headers)@@ -597,8 +600,8 @@ func (o *FsObjectSwift) Update(in io.Reader, modTime time.Time, size int64) erroreturn err}} else {- headers["X-Object-Manifest"] = "" // remove manifest- _, err := o.swift.c.ObjectPut(o.swift.container, o.swift.root+o.remote, in, true, "", "", m.ObjectHeaders())+ headers["Content-Length"] = strconv.FormatInt(size, 10) // set Content-Length as we know it+ _, err := o.swift.c.ObjectPut(o.swift.container, o.swift.root+o.remote, in, true, "", "", headers)if err != nil {return err}