From 6966dbf3116bec65ddb321c3db27e2760101d856 Mon Sep 17 00:00:00 2001 From: Ryan Miller <43447928+Rmiller5466@users.noreply.github.com> Date: Thu, 3 Jul 2025 12:48:51 -0400 Subject: [PATCH] lookup root dir name if none is present --- http/raw.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/http/raw.go b/http/raw.go index 4e9438e8..5159d58f 100644 --- a/http/raw.go +++ b/http/raw.go @@ -177,7 +177,17 @@ func rawDirHandler(w http.ResponseWriter, r *http.Request, d *data, file *files. name := filepath.Base(commonDir) if name == "." || name == "" || name == string(filepath.Separator) { - name = file.Name + // Not sure when/if this will ever be true, though kept incase there is an edge-case where it is + if file.Name != "" { + name = file.Name + } else { + // This should indicate that the fs root is the directory being downloaded, lookup its name + actual, err := file.Fs.Stat(".") + if err != nil { + return http.StatusInternalServerError, err + } + name = actual.Name() + } } // Prefix used to distinguish a filelist generated // archive from the full directory archive