mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
s3: report http.StatusOK if the directory is explicitly created
fix https://github.com/seaweedfs/seaweedfs/issues/3457
This commit is contained in:
parent
911475526c
commit
9fce75607d
|
@ -36,6 +36,8 @@ const (
|
|||
AmzObjectTaggingPrefix = "X-Amz-Tagging-"
|
||||
AmzObjectTaggingDirective = "X-Amz-Tagging-Directive"
|
||||
AmzTagCount = "x-amz-tagging-count"
|
||||
|
||||
X_SeaweedFS_Header_Directory_Key = "x-seaweedfs-is-directory-key"
|
||||
)
|
||||
|
||||
// Non-Standard S3 HTTP request constants
|
||||
|
|
|
@ -393,6 +393,12 @@ func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, des
|
|||
return
|
||||
}
|
||||
|
||||
if resp.Header.Get(s3_constants.X_SeaweedFS_Header_Directory_Key) == "true" {
|
||||
responseStatusCode := responseFn(resp, w)
|
||||
s3err.PostLog(r, responseStatusCode, s3err.ErrNone)
|
||||
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 {
|
||||
|
|
|
@ -111,6 +111,10 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
|
|||
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
if entry.Attr.Mime != "" {
|
||||
// inform S3 API this is a user created directory key object
|
||||
w.Header().Set(s3_constants.X_SeaweedFS_Header_Directory_Key, "true")
|
||||
}
|
||||
fs.listDirectoryHandler(w, r)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue