Konstantin Lebedev
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
5 additions and
5 deletions
-
weed/s3api/s3_constants/s3_actions.go
-
weed/s3api/s3api_object_handlers.go
-
weed/server/filer_server_handlers_read.go
|
|
@ -9,4 +9,5 @@ const ( |
|
|
|
|
|
|
|
SeaweedStorageDestinationHeader = "x-seaweedfs-destination" |
|
|
|
MultipartUploadsFolder = ".uploads" |
|
|
|
FolderMimeType = "httpd/unix-directory" |
|
|
|
) |
|
|
@ -99,7 +99,7 @@ func (s3a *S3ApiServer) PutObjectHandler(w http.ResponseWriter, r *http.Request) |
|
|
|
s3a.option.BucketsPath, bucket+strings.TrimSuffix(object, "/"), |
|
|
|
func(entry *filer_pb.Entry) { |
|
|
|
if objectContentType == "" { |
|
|
|
objectContentType = "httpd/unix-directory" |
|
|
|
objectContentType = s3_constants.FolderMimeType |
|
|
|
} |
|
|
|
entry.Attributes.Mime = objectContentType |
|
|
|
}); err != nil { |
|
|
|
|
|
@ -15,8 +15,6 @@ import ( |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
|
|
|
|
"golang.org/x/exp/slices" |
|
|
|
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/filer" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/glog" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/images" |
|
|
@ -120,7 +118,8 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) |
|
|
|
writeJsonQuiet(w, r, http.StatusOK, entry) |
|
|
|
return |
|
|
|
} |
|
|
|
if slices.Contains([]string{"httpd/unix-directory", ""}, entry.Attr.Mime) { |
|
|
|
if entry.Attr.Mime == "" || (entry.Attr.Mime == s3_constants.FolderMimeType && r.Header.Get(s3_constants.AmzIdentityId) == "") { |
|
|
|
// return index of directory for non s3 gateway
|
|
|
|
fs.listDirectoryHandler(w, r) |
|
|
|
return |
|
|
|
} |
|
|
@ -128,7 +127,7 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) |
|
|
|
w.Header().Set(s3_constants.X_SeaweedFS_Header_Directory_Key, "true") |
|
|
|
} |
|
|
|
|
|
|
|
if isForDirectory { |
|
|
|
if isForDirectory && entry.Attr.Mime != s3_constants.FolderMimeType { |
|
|
|
w.WriteHeader(http.StatusNotFound) |
|
|
|
return |
|
|
|
} |
|
|
|