From 9442e00997d3d0f125505eed4e7f06c44bb9c71a Mon Sep 17 00:00:00 2001 From: codeskyblue Date: Fri, 15 Feb 2019 17:51:21 +0800 Subject: [PATCH] unzip ignore .ghs.yml --- zip.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zip.go b/zip.go index 54a4be3..0a676f1 100644 --- a/zip.go +++ b/zip.go @@ -150,11 +150,16 @@ func unzipFile(filename, dest string) error { } defer rc.Close() - fpath := filepath.Join(dest, f.Name) + // ignore .ghs.yml + filename := sanitizedName(f.Name) + if filepath.Base(filename) == ".ghs.yml" { + continue + } + fpath := filepath.Join(dest, filename) // filename maybe GBK or UTF-8 // Ref: https://studygolang.com/articles/3114 - if f.Flags & (1<<11) == 0 { // GBK + if f.Flags&(1<<11) == 0 { // GBK tr := simplifiedchinese.GB18030.NewDecoder() fpathUtf8, err := tr.String(fpath) if err == nil { @@ -180,4 +185,4 @@ func unzipFile(filename, dest string) error { } } return nil -} \ No newline at end of file +}