From bc7af51e52b9f2cc082eaaadc659abcbc149690a Mon Sep 17 00:00:00 2001 From: WeidiDeng Date: Mon, 17 Oct 2022 22:26:26 +0800 Subject: [PATCH] ignore empty root dir name when compressing file fix [350](https://github.com/mholt/archiver/issues/350) --- archiver.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/archiver.go b/archiver.go index 35cdc3d3..36a6dba0 100644 --- a/archiver.go +++ b/archiver.go @@ -77,6 +77,10 @@ func FilesFromDisk(options *FromDiskOptions, filenames map[string]string) ([]Fil } nameInArchive := nameOnDiskToNameInArchive(filename, rootOnDisk, rootInArchive) + // this is the root folder and we are adding its contents to target rootInArchive + if info.IsDir() && nameInArchive == "" { + return nil + } // handle symbolic links var linkTarget string