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) fs.Debug(o, "Failed to read info: %s", err)
return err return err
} }
size, err := strconv.ParseInt(headers["Content-Length"], 10, 64) var size int64
if err != nil { // Ignore missing Content-Length assuming it is 0
fs.Debug(o, "Failed to read size from: %q", headers) // Some versions of ceph do this due their apache proxies
return err 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.etag = headers["Etag"]
o.bytes = size o.bytes = size