Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Oct 27, 2024
1 parent 37b672b commit 4c5da95
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/io/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ func Compress(dir string, src []string, dst string) error {
}
// 去掉路径前缀,减少压缩包内文件夹层级
for i, s := range src {
src[i] = strings.TrimPrefix(s, dir)
if strings.HasPrefix(s, dir) {
s = strings.TrimPrefix(s, dir)
src[i] = strings.TrimPrefix(s, "/")
}
if src[i] == "" {
src[i] = "."
}
Expand Down

0 comments on commit 4c5da95

Please sign in to comment.