xl: Fix GET of an empty multiparted object (#3646)

GetObject returns unsatisfied range error when we try to download an object
uploaded using multipart mechanism.
master
Anis Elleuch 8 years ago committed by Harshavardhana
parent 02194ee3c6
commit e1bc99e4fe
  1. 8
      cmd/xl-v1-object.go

@ -198,8 +198,14 @@ func (xl xlObjects) GetObject(bucket, object string, startOffset int64, length i
return traceError(InvalidRange{startOffset, length, xlMeta.Stat.Size})
}
// Calculate endOffset according to length
endOffset := startOffset
if length > 0 {
endOffset += length - 1
}
// Get last part index to read given length.
lastPartIndex, _, err := xlMeta.ObjectToPartOffset(startOffset + length - 1)
lastPartIndex, _, err := xlMeta.ObjectToPartOffset(endOffset)
if err != nil {
return traceError(InvalidRange{startOffset, length, xlMeta.Stat.Size})
}

Loading…
Cancel
Save