From bfcc9ca808ebee6997d9def960655bd5f3773a99 Mon Sep 17 00:00:00 2001 From: banjiaojuhao Date: Sun, 6 Mar 2022 18:12:12 +0800 Subject: [PATCH] filer: support metadata with resolved manifest chunk --- weed/server/filer_server_handlers_read.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/weed/server/filer_server_handlers_read.go b/weed/server/filer_server_handlers_read.go index 431eea979..17a6b3049 100644 --- a/weed/server/filer_server_handlers_read.go +++ b/weed/server/filer_server_handlers_read.go @@ -119,7 +119,16 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) return } - if r.URL.Query().Has("metadata") { + query := r.URL.Query() + if query.Get("metadata") == "true" { + if query.Get("resolveManifest") == "true" { + if entry.Chunks, _, err = filer.ResolveChunkManifest( + fs.filer.MasterClient.GetLookupFileIdFunction(), + entry.Chunks, 0, int64(entry.Size())); err != nil { + err = fmt.Errorf("failed to resolve chunk manifest, err: %s", err.Error()) + writeJsonError(w, r, http.StatusInternalServerError, err) + } + } writeJsonQuiet(w, r, http.StatusOK, entry) return }