fix: do not clean bpath when it is empty to not root into '.'

This commit is contained in:
DenKoren 2024-03-25 07:58:26 +01:00
parent 08d1d4a126
commit 8292c09038
1 changed files with 4 additions and 1 deletions

View File

@ -55,7 +55,10 @@ func (b *BasePathFs) RealPath(name string) (path string, err error) {
return name, err return name, err
} }
bpath := filepath.Clean(b.path) bpath := b.path
if bpath != "" {
bpath = filepath.Clean(b.path)
}
path = filepath.Clean(filepath.Join(bpath, name)) path = filepath.Clean(filepath.Join(bpath, name))
if !strings.HasPrefix(path, bpath) { if !strings.HasPrefix(path, bpath) {
return name, os.ErrNotExist return name, os.ErrNotExist