metainfo/info.go | 10 +++++++++- diff --git a/metainfo/info.go b/metainfo/info.go index 1c2d0b85b9abef37b32b662fc189c504108b957d..6b251884db6984f27f820cf8306d43eb5e5dbffd 100644 --- a/metainfo/info.go +++ b/metainfo/info.go @@ -26,7 +26,15 @@ // 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 {