diff --git a/weed/server/filer_server_handlers_read.go b/weed/server/filer_server_handlers_read.go index 8c3d4bcd8..645a3fb44 100644 --- a/weed/server/filer_server_handlers_read.go +++ b/weed/server/filer_server_handlers_read.go @@ -107,9 +107,15 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) return } + query := r.URL.Query() + if entry.IsDirectory() { if fs.option.DisableDirListing { - w.WriteHeader(http.StatusMethodNotAllowed) + w.WriteHeader(http.StatusForbidden) + return + } + if query.Get("metadata") == "true" { + writeJsonQuiet(w, r, http.StatusOK, entry) return } if entry.Attr.Mime == "" { @@ -125,7 +131,6 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) return } - query := r.URL.Query() if query.Get("metadata") == "true" { if query.Get("resolveManifest") == "true" { if entry.Chunks, _, err = filer.ResolveChunkManifest(