1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-14 01:34:47 +08:00

fix: 解决 zip 压缩前后大小不变的问题 (#3610)

This commit is contained in:
zhengkunwang 2024-01-15 14:15:26 +08:00 committed by GitHub
parent 817fd123da
commit 6f0f282b7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -606,12 +606,12 @@ func ZipFile(files []archiver.File, dst afero.File) error {
if err != nil {
return err
}
hdr.Method = zip.Deflate
hdr.Name = file.NameInArchive
if file.IsDir() {
if !strings.HasSuffix(hdr.Name, "/") {
hdr.Name += "/"
}
hdr.Method = zip.Store
}
w, err := zw.CreateHeader(hdr)
if err != nil {