mirror of https://github.com/spf13/afero.git
fix: do not clean bpath when it is empty to not root into '.'
This commit is contained in:
parent
08d1d4a126
commit
8292c09038
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue