Fix transfer issue with gzip payloads

This commit is contained in:
Aaron Eppert 2023-10-13 20:56:36 +00:00
parent b9727cc6ab
commit d3bab98390

View File

@ -363,7 +363,14 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadClo
if err != nil {
return nil, err
}
o.bytes = *bytes
if bytes == nil {
// Must set these as "defaults" since the HTTP payload is compressed and the handler will decompress by default,
// otherwise we end up with a file size and hash mismatch
o.bytes = -1
o.md5 = ""
} else {
o.bytes = *bytes
}
return resp.HTTPResponse().Body, nil
}