mirror of
https://github.com/versity/versitygw.git
synced 2026-01-05 11:24:52 +00:00
fix range gets with unspecified end range
The aws cli will send range gets of an object with ranges like the following: bytes=0-8388607 bytes=8388608-16777215 bytes=16777216-25165823 bytes=25165824- The last one with the end offset unspecified just means the rest of the object. So this fixes that case where there is only one offset in the range.
This commit is contained in:
@@ -923,7 +923,34 @@ func TestRangeGet(s *S3Conf) {
|
||||
}
|
||||
|
||||
// bytes range is inclusive, go range for second value is not
|
||||
if !isSame(b, data[100:201]) {
|
||||
if !isEqual(b, data[100:201]) {
|
||||
failF("%v: data mismatch of range", testname)
|
||||
return
|
||||
}
|
||||
|
||||
rangeString = "bytes=100-"
|
||||
|
||||
ctx, cancel = context.WithTimeout(context.Background(), shortTimeout)
|
||||
out, err = s3client.GetObject(ctx, &s3.GetObjectInput{
|
||||
Bucket: &bucket,
|
||||
Key: &name,
|
||||
Range: &rangeString,
|
||||
})
|
||||
defer cancel()
|
||||
if err != nil {
|
||||
failF("%v: %v", testname, err)
|
||||
return
|
||||
}
|
||||
defer out.Body.Close()
|
||||
|
||||
b, err = io.ReadAll(out.Body)
|
||||
if err != nil {
|
||||
failF("%v: read body %v", testname, err)
|
||||
return
|
||||
}
|
||||
|
||||
// bytes range is inclusive, go range for second value is not
|
||||
if !isEqual(b, data[100:]) {
|
||||
failF("%v: data mismatch of range", testname)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user