From 95bae91ca750b2b90cf702df9561fd8b5a82c14c Mon Sep 17 00:00:00 2001 From: zemul Date: Thu, 22 Aug 2024 02:01:18 +0800 Subject: [PATCH] Fix get dir metadata (#5923) * fix:mount deadlock * feat: query dir metadata * feat: query dir metadata --------- Co-authored-by: zemul --- weed/server/filer_server_handlers_read.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/weed/server/filer_server_handlers_read.go b/weed/server/filer_server_handlers_read.go index a02e6c2c1..12371a8f6 100644 --- a/weed/server/filer_server_handlers_read.go +++ b/weed/server/filer_server_handlers_read.go @@ -122,13 +122,15 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) return } if query.Get("metadata") == "true" { + writeJsonQuiet(w, r, http.StatusOK, entry) + return + } + if entry.Attr.Mime == "" || (entry.Attr.Mime == s3_constants.FolderMimeType && r.Header.Get(s3_constants.AmzIdentityId) == "") { // Don't return directory meta if config value is set to true if fs.option.ExposeDirectoryData == false { writeJsonError(w, r, http.StatusForbidden, errors.New("directory listing is disabled")) return } - } - 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