Skip to content

Commit

Permalink
ignore empty root dir name when compressing file
Browse files Browse the repository at this point in the history
fix [350](mholt#350)
  • Loading branch information
WeidiDeng committed Oct 17, 2022
1 parent be18265 commit bc7af51
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bc7af51

Please sign in to comment.