diff options
| author | chrislu <chris.lu@gmail.com> | 2022-08-18 02:13:58 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-08-18 02:13:58 -0700 |
| commit | 42c6e5251363f0437f22eace84589856ff06f669 (patch) | |
| tree | aec162cf1e672cade29b68d6ca4b01fde6e5af84 | |
| parent | 4573c99ae34530e562dc7ffcc261bd27224a71e7 (diff) | |
| download | seaweedfs-42c6e5251363f0437f22eace84589856ff06f669.tar.xz seaweedfs-42c6e5251363f0437f22eace84589856ff06f669.zip | |
s3: fix regression on HEAD directory operation
| -rw-r--r-- | weed/s3api/s3api_object_handlers.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go index f3b34fa4d..5ff98e022 100644 --- a/weed/s3api/s3api_object_handlers.go +++ b/weed/s3api/s3api_object_handlers.go @@ -388,6 +388,18 @@ func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, des } } + if resp.StatusCode == http.StatusNotFound { + s3err.WriteErrorResponse(w, r, s3err.ErrNoSuchKey) + return + } + + // when HEAD a directory, it should be reported as no such key + // https://github.com/seaweedfs/seaweedfs/issues/3457 + if resp.ContentLength == -1 && resp.StatusCode != http.StatusNotModified { + s3err.WriteErrorResponse(w, r, s3err.ErrNoSuchKey) + return + } + responseStatusCode := responseFn(resp, w) s3err.PostLog(r, responseStatusCode, s3err.ErrNone) } |
