Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

s3: Treat missing Content-Length as 0 for some ceph installations

Nick Craig-Wooddef9adac4ec8
diff --git a/s3/s3.go b/s3/s3.go
index b38994767..45a543b36 100644
--- a/s3/s3.go
+++ b/s3/s3.go
@@ -429,10 +429,15 @@ func (o *FsObjectS3) readMetaData() (err error) {
fs.Debug(o, "Failed to read info: %s", err)
return err
}
- size, err := strconv.ParseInt(headers["Content-Length"], 10, 64)
- if err != nil {
- fs.Debug(o, "Failed to read size from: %q", headers)
- return err
+ var size int64
+ // Ignore missing Content-Length assuming it is 0
+ // Some versions of ceph do this due their apache proxies
+ if contentLength, ok := headers["Content-Length"]; ok {
+ size, err = strconv.ParseInt(contentLength, 10, 64)
+ if err != nil {
+ fs.Debug(o, "Failed to read size from: %q", headers)
+ return err
+ }
}
o.etag = headers["Etag"]
o.bytes = size