Browse Source

fileserver: Fix "go up" links in browse listings (closes #3942)

At some point we changed how paths are represented down the function calls of browse listings and forgot to update the canGoUp logic. I think this is right? It's simpler now.
master
Matthew Holt 5 years ago
parent
commit
d8bcf5be4e
No known key found for this signature in database GPG Key ID: 2A349DD577D586A5
  1. 5
      modules/caddyhttp/fileserver/browse.go

5
modules/caddyhttp/fileserver/browse.go

@ -99,9 +99,8 @@ func (fsrv *FileServer) loadDirectoryContents(dir *os.File, root, urlPath string
return browseListing{}, err
}
// determine if user can browse up another folder
curPathDir := path.Dir(strings.TrimSuffix(urlPath, "/"))
canGoUp := strings.HasPrefix(curPathDir, root)
// user can presumably browse "up" to parent folder if path is longer than "/"
canGoUp := len(urlPath) > 1
return fsrv.directoryListing(files, canGoUp, root, urlPath, repl), nil
}

Loading…
Cancel
Save