From aa3b8644263aff11eb98fccbf63c0cdd5895c97a Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 1 Sep 2021 16:17:23 +1000 Subject: [PATCH] Fix info name when building from . and .. --- metainfo/info.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/metainfo/info.go b/metainfo/info.go index 1c2d0b85..6b251884 100644 --- a/metainfo/info.go +++ b/metainfo/info.go @@ -26,7 +26,15 @@ type Info struct { // This is a helper that sets Files and Pieces from a root path and its // children. func (info *Info) BuildFromFilePath(root string) (err error) { - info.Name = filepath.Base(root) + info.Name = func() string { + b := filepath.Base(root) + switch b { + case ".", "..", string(filepath.Separator): + return "" + default: + return b + } + }() info.Files = nil err = filepath.Walk(root, func(path string, fi os.FileInfo, err error) error { if err != nil { -- 2.48.1