From 27e084c109ffc199fd044dd9a7fd87c14a88d554 Mon Sep 17 00:00:00 2001 From: Connor Newton Date: Fri, 28 Sep 2018 16:41:39 +0100 Subject: [PATCH] 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. --- basepath.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basepath.go b/basepath.go index 616ff8f..fe12f97 100644 --- a/basepath.go +++ b/basepath.go @@ -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 }