refactor: ScopedFs to avoid escaping symlinks

This commit is contained in:
Henrique Dias committed 2026-06-07 18:16:46 +02:00
1 parent 3406d3d7f9
commit 7c2c0a11b3
15 files changed
+277 -210

No files matched your search

+1 -6
View File
@@ -10,11 +10,10 @@ import (
"path/filepath"
"strings"
"github.com/mholt/archives"
"github.com/filebrowser/filebrowser/v2/files"
"github.com/filebrowser/filebrowser/v2/fileutils"
"github.com/filebrowser/filebrowser/v2/users"
"github.com/mholt/archives"
)
func slashClean(name string) string {
@@ -115,10 +114,6 @@ func getFiles(d *data, path, commonPath string) ([]archives.FileInfo, error) {
return nil, nil
}
if ok, err := files.WithinScope(d.user.Fs, path); err != nil || !ok {
return nil, nil
}
info, err := d.user.Fs.Stat(path)
if err != nil {
return nil, err