Browse Source

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

pull/3617/head
zhengkunwang 10 months ago committed by GitHub
parent
commit
6f0f282b7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      backend/utils/files/file_op.go

2
backend/utils/files/file_op.go

@ -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 {

Loading…
Cancel
Save