aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api
diff options
context:
space:
mode:
Diffstat (limited to 'weed/s3api')
-rw-r--r--weed/s3api/s3api_object_handlers.go5
-rw-r--r--weed/s3api/s3err/s3api_errors.go8
2 files changed, 12 insertions, 1 deletions
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go
index e6731e5be..e6140fd1a 100644
--- a/weed/s3api/s3api_object_handlers.go
+++ b/weed/s3api/s3api_object_handlers.go
@@ -333,6 +333,11 @@ func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, des
}
defer util.CloseResponse(resp)
+ if resp.StatusCode == http.StatusPreconditionFailed {
+ writeErrorResponse(w, s3err.ErrPreconditionFailed, r.URL)
+ return
+ }
+
if (resp.ContentLength == -1 || resp.StatusCode == 404) && resp.StatusCode != 304 {
if r.Method != "DELETE" {
writeErrorResponse(w, s3err.ErrNoSuchKey, r.URL)
diff --git a/weed/s3api/s3err/s3api_errors.go b/weed/s3api/s3err/s3api_errors.go
index 258f21523..7f0ffdf86 100644
--- a/weed/s3api/s3err/s3api_errors.go
+++ b/weed/s3api/s3err/s3api_errors.go
@@ -93,6 +93,7 @@ const (
ErrInvalidRequest
ErrAuthNotSetup
ErrNotImplemented
+ ErrPreconditionFailed
ErrExistingObjectIsDirectory
)
@@ -342,7 +343,7 @@ var errorCodeResponse = map[ErrorCode]APIError{
Description: "Invalid Request",
HTTPStatusCode: http.StatusBadRequest,
},
- ErrAuthNotSetup : {
+ ErrAuthNotSetup: {
Code: "InvalidRequest",
Description: "Signed request requires setting up SeaweedFS S3 authentication",
HTTPStatusCode: http.StatusBadRequest,
@@ -352,6 +353,11 @@ var errorCodeResponse = map[ErrorCode]APIError{
Description: "A header you provided implies functionality that is not implemented",
HTTPStatusCode: http.StatusNotImplemented,
},
+ ErrPreconditionFailed: {
+ Code: "PreconditionFailed",
+ Description: "At least one of the pre-conditions you specified did not hold",
+ HTTPStatusCode: http.StatusPreconditionFailed,
+ },
ErrExistingObjectIsDirectory: {
Code: "ExistingObjectIsDirectory",
Description: "Existing Object is a directory.",