1
mirror of https://github.com/rclone/rclone synced 2024-12-22 13:03:02 +01:00

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

This commit is contained in:
Nick Craig-Wood 2014-05-16 16:27:53 +01:00
parent 083bb154ba
commit def9adac4e

View File

@ -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