SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
return xml encoded NotFound status code for s3 delete
Rinat Shigapovfafc41a27fd3
diff --git a/weed/s3api/s3api_errors.go b/weed/s3api/s3api_errors.goindex 3f97c73cb3..ff411f2765 100644--- a/weed/s3api/s3api_errors.go+++ b/weed/s3api/s3api_errors.go@@ -33,6 +33,7 @@ const (ErrBucketAlreadyExistsErrBucketAlreadyOwnedByYouErrNoSuchBucket+ ErrNoSuchKeyErrNoSuchUploadErrInvalidBucketNameErrInvalidDigest@@ -134,6 +135,11 @@ var errorCodeResponse = map[ErrorCode]APIError{Description: "The specified bucket does not exist",HTTPStatusCode: http.StatusNotFound,},+ ErrNoSuchKey: {+ Code: "NoSuchKey",+ Description: "The specified key does not exist.",+ HTTPStatusCode: http.StatusNotFound,+ },ErrNoSuchUpload: {Code: "NoSuchUpload",Description: "The specified multipart upload does not exist. The upload ID may be invalid, or the upload may have been aborted or completed.",diff --git a/weed/s3api/s3api_handlers.go b/weed/s3api/s3api_handlers.goindex 45a7cbc2ea..7ef676400b 100644--- a/weed/s3api/s3api_handlers.go+++ b/weed/s3api/s3api_handlers.go@@ -7,6 +7,7 @@ import ("fmt""net/http""net/url"+ "strconv""time""google.golang.org/grpc"@@ -76,13 +77,19 @@ func getRESTErrorResponse(err APIError, resource string) RESTErrorResponse {func writeResponse(w http.ResponseWriter, statusCode int, response []byte, mType mimeType) {setCommonHeaders(w)+ if response != nil {+ w.Header().Set("Content-Length", strconv.Itoa(len(response)))+ }if mType != mimeNone {w.Header().Set("Content-Type", string(mType))}w.WriteHeader(statusCode)if response != nil {glog.V(4).Infof("status %d %s: %s", statusCode, mType, string(response))- w.Write(response)+ _, err := w.Write(response)+ if err != nil {+ glog.V(0).Infof("write err: %v", err)+ }w.(http.Flusher).Flush()}}diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.goindex ce3bdba8cd..7c6eaeb70e 100644--- a/weed/s3api/s3api_object_handlers.go+++ b/weed/s3api/s3api_object_handlers.go@@ -112,6 +112,10 @@ func (s3a *S3ApiServer) DeleteObjectHandler(w http.ResponseWriter, r *http.Requefor k, v := range proxyResponse.Header {w.Header()[k] = v}+ if proxyResponse.StatusCode == http.StatusNotFound {+ writeErrorResponse(w, ErrNoSuchKey, r.URL)+ return+ }w.WriteHeader(proxyResponse.StatusCode)})