fix: consider partNumber in GET/HEAD requests (#10618)

This commit is contained in:
Anis Elleuch
2020-10-01 23:41:12 +01:00
committed by GitHub
parent f28d02b7f2
commit 71403be912
4 changed files with 52 additions and 20 deletions

View File

@@ -562,6 +562,15 @@ type ObjReaderFn func(inputReader io.Reader, h http.Header, pcfn CheckPreconditi
func NewGetObjectReader(rs *HTTPRangeSpec, oi ObjectInfo, opts ObjectOptions, cleanUpFns ...func()) (
fn ObjReaderFn, off, length int64, err error) {
if rs == nil && opts.PartNumber > 0 {
var start, end int64
for i := 0; i < len(oi.Parts) && i < opts.PartNumber; i++ {
start = end
end = start + oi.Parts[i].ActualSize - 1
}
rs = &HTTPRangeSpec{Start: start, End: end}
}
// Call the clean-up functions immediately in case of exit
// with error
defer func() {