Browse Source
Merge pull request #3154 from kmlebedev/s3_test_invalid_range
pull/3155/head
Chris Lu
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
11 additions and
0 deletions
-
weed/s3api/s3api_object_handlers.go
-
weed/s3api/s3err/s3api_errors.go
|
|
@ -353,6 +353,11 @@ func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, des |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if resp.StatusCode == http.StatusRequestedRangeNotSatisfiable { |
|
|
|
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidRange) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (resp.ContentLength == -1 || resp.StatusCode == 404) && resp.StatusCode != 304 { |
|
|
|
if r.Method != "DELETE" { |
|
|
|
s3err.WriteErrorResponse(w, r, s3err.ErrNoSuchKey) |
|
|
|
|
|
@ -64,6 +64,7 @@ const ( |
|
|
|
ErrInvalidMaxDeleteObjects |
|
|
|
ErrInvalidPartNumberMarker |
|
|
|
ErrInvalidPart |
|
|
|
ErrInvalidRange |
|
|
|
ErrInternalError |
|
|
|
ErrInvalidCopyDest |
|
|
|
ErrInvalidCopySource |
|
|
@ -370,6 +371,11 @@ var errorCodeResponse = map[ErrorCode]APIError{ |
|
|
|
Description: "Invalid Request", |
|
|
|
HTTPStatusCode: http.StatusBadRequest, |
|
|
|
}, |
|
|
|
ErrInvalidRange: { |
|
|
|
Code: "InvalidRange", |
|
|
|
Description: "The requested range is not satisfiable", |
|
|
|
HTTPStatusCode: http.StatusRequestedRangeNotSatisfiable, |
|
|
|
}, |
|
|
|
ErrAuthNotSetup: { |
|
|
|
Code: "InvalidRequest", |
|
|
|
Description: "Signed request requires setting up SeaweedFS S3 authentication", |
|
|
|