mirror of https://github.com/spf13/afero.git
Fix MemMapFs RealPath error when BasePath = ""
bpath cleans to ".", but paths "./*" clean to "*". This results in "." not found as prefix of "*" except for hidden files and dirs. Skip the prefix check if bpath == "." as this is lexically equivalent to "", which could satisfy the check.
This commit is contained in:
parent
787d034dfe
commit
27e084c109
|
@ -46,7 +46,7 @@ func (b *BasePathFs) RealPath(name string) (path string, err error) {
|
|||
|
||||
bpath := filepath.Clean(b.path)
|
||||
path = filepath.Clean(filepath.Join(bpath, name))
|
||||
if !strings.HasPrefix(path, bpath) {
|
||||
if bpath != "." && !strings.HasPrefix(path, bpath) {
|
||||
return name, os.ErrNotExist
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue