diff options
| author | hilimd <68371223+hilimd@users.noreply.github.com> | 2020-11-22 20:29:17 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-22 20:29:17 +0800 |
| commit | 9aa990f80f8af70628c72eaf0c20d445c15b9e9d (patch) | |
| tree | 2dd4ed5551515b207074bf27908432b0293cd321 /weed/s3api/s3api_object_handlers.go | |
| parent | e8296104fc715f0f7c41a82059f366603b3e94f0 (diff) | |
| parent | 92f906b6fcce2ef72661bb825075e2826b8f3aa1 (diff) | |
| download | seaweedfs-9aa990f80f8af70628c72eaf0c20d445c15b9e9d.tar.xz seaweedfs-9aa990f80f8af70628c72eaf0c20d445c15b9e9d.zip | |
Merge pull request #39 from chrislusf/master
sync
Diffstat (limited to 'weed/s3api/s3api_object_handlers.go')
| -rw-r--r-- | weed/s3api/s3api_object_handlers.go | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go index 7ea49f2c6..401e2f96c 100644 --- a/weed/s3api/s3api_object_handlers.go +++ b/weed/s3api/s3api_object_handlers.go @@ -113,12 +113,6 @@ func (s3a *S3ApiServer) DeleteObjectHandler(w http.ResponseWriter, r *http.Reque bucket, object := getBucketAndObject(r) - response, _ := s3a.listFilerEntries(bucket, object, 1, "", "/") - if len(response.Contents) != 0 && strings.HasSuffix(object, "/") { - w.WriteHeader(http.StatusNoContent) - return - } - destUrl := fmt.Sprintf("http://%s%s/%s%s?recursive=true", s3a.option.Filer, s3a.option.BucketsPath, bucket, object) @@ -266,11 +260,6 @@ func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, des resp, postErr := client.Do(proxyReq) - if (resp.ContentLength == -1 || resp.StatusCode == 404) && !strings.HasSuffix(destUrl, "/") { - writeErrorResponse(w, s3err.ErrNoSuchKey, r.URL) - return - } - if postErr != nil { glog.Errorf("post to filer: %v", postErr) writeErrorResponse(w, s3err.ErrInternalError, r.URL) @@ -278,6 +267,11 @@ func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, des } defer util.CloseResponse(resp) + if (resp.ContentLength == -1 || resp.StatusCode == 404) && !strings.HasSuffix(destUrl, "/") { + writeErrorResponse(w, s3err.ErrNoSuchKey, r.URL) + return + } + responseFn(resp, w) } |
