mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-07-06 08:03:03 +00:00
fix: lookup directory name if blank when downloading shared directory
This commit is contained in:
parent
244fda2f2c
commit
046d6193c5
13
http/raw.go
13
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user