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:
Connor Newton 2018-09-28 16:41:39 +01:00
parent 787d034dfe
commit 27e084c109
1 changed files with 1 additions and 1 deletions

View File

@ -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
}