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
s3: report http.StatusOK if the directory is explicitly created
chrislu9fce75607dd4
diff --git a/weed/s3api/s3_constants/header.go b/weed/s3api/s3_constants/header.goindex cd725d4356..a189551851 100644--- a/weed/s3api/s3_constants/header.go+++ b/weed/s3api/s3_constants/header.go@@ -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 constantsdiff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.goindex 5ff98e022e..1525889fd0 100644--- a/weed/s3api/s3api_object_handlers.go+++ b/weed/s3api/s3api_object_handlers.go@@ -393,6 +393,12 @@ func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, desreturn}+ 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/3457if resp.ContentLength == -1 && resp.StatusCode != http.StatusNotModified {diff --git a/weed/server/filer_server_handlers_read.go b/weed/server/filer_server_handlers_read.goindex 718071da18..58df2f5245 100644--- a/weed/server/filer_server_handlers_read.go+++ b/weed/server/filer_server_handlers_read.go@@ -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}