Merge pull request #191 from versity/fix/issue-184

Issue 184
This commit is contained in:
Ben McClelland
2023-08-04 09:32:53 -07:00
committed by GitHub
2 changed files with 14 additions and 1 deletions

View File

@@ -1095,7 +1095,7 @@ func (p *Posix) GetObject(_ context.Context, input *s3.GetObjectInput, writer io
}
if startOffset+length > fi.Size()+1 {
return nil, s3err.GetAPIError(s3err.ErrInvalidRequest)
return nil, s3err.GetAPIError(s3err.ErrInvalidRange)
}
if acceptRange != "" {

View File

@@ -1087,6 +1087,19 @@ func TestRangeGet(s *S3Conf) {
return
}
lgRange := "bytes=20000000-30000000000"
ctx, cancel = context.WithTimeout(context.Background(), shortTimeout)
_, err = s3client.GetObject(ctx, &s3.GetObjectInput{
Bucket: &bucket,
Key: &name,
Range: &lgRange,
})
cancel()
if err == nil {
failF("%v: expected range error", testname)
return
}
// Invalid range
invRange := "bytes=100-asd"
ctx, cancel = context.WithTimeout(context.Background(), shortTimeout)