diff --git a/http/raw.go b/http/raw.go index 4e9438e8..cd05a1bc 100644 --- a/http/raw.go +++ b/http/raw.go @@ -177,7 +177,18 @@ 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, statErr := file.Fs.Stat(".") + if statErr != nil { + return http.StatusInternalServerError, statErr + } + name = actual.Name() + } } // Prefix used to distinguish a filelist generated // archive from the full directory archive