aboutsummaryrefslogtreecommitdiff
path: root/weed/server/filer_server_handlers_read.go
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2022-08-24 12:15:44 +0500
committerGitHub <noreply@github.com>2022-08-24 00:15:44 -0700
commitf7aeb06544ef12d49f39010dcedcd34845deddff (patch)
tree6ef638e1ffff65d9fe834c336cea6fbaf98374bf /weed/server/filer_server_handlers_read.go
parentc57c79a0ab2cb2b83c2f7ebf90a0d86c621f4d9f (diff)
downloadseaweedfs-f7aeb06544ef12d49f39010dcedcd34845deddff.tar.xz
seaweedfs-f7aeb06544ef12d49f39010dcedcd34845deddff.zip
s3: report metadata if the directory is explicitly created (#3498)
* replace mkdir to mkFile * ContentLength must be zero * revert mkDir * Seaweedfs-Is-Directory-Key return metadata
Diffstat (limited to 'weed/server/filer_server_handlers_read.go')
-rw-r--r--weed/server/filer_server_handlers_read.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/weed/server/filer_server_handlers_read.go b/weed/server/filer_server_handlers_read.go
index 58df2f524..327eaa54d 100644
--- a/weed/server/filer_server_handlers_read.go
+++ b/weed/server/filer_server_handlers_read.go
@@ -25,10 +25,11 @@ import (
// Validates the preconditions. Returns true if GET/HEAD operation should not proceed.
// Preconditions supported are:
-// If-Modified-Since
-// If-Unmodified-Since
-// If-Match
-// If-None-Match
+//
+// If-Modified-Since
+// If-Unmodified-Since
+// If-Match
+// If-None-Match
func checkPreconditions(w http.ResponseWriter, r *http.Request, entry *filer.Entry) bool {
etag := filer.ETagEntry(entry)
@@ -111,12 +112,12 @@ 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")
+ if entry.Attr.Mime == "" {
+ fs.listDirectoryHandler(w, r)
+ return
}
- fs.listDirectoryHandler(w, r)
- return
+ // inform S3 API this is a user created directory key object
+ w.Header().Set(s3_constants.X_SeaweedFS_Header_Directory_Key, "true")
}
if isForDirectory {