Skip to content

Commit

Permalink
修复文件解压权限未正确赋值问题
Browse files Browse the repository at this point in the history
  • Loading branch information
bearki committed Jun 28, 2024
1 parent 8e1b1e9 commit d5b5546
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tool/zip.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func DeCompressZip(zipFile string, dstDir string) error {
return e
}
defer dstFile.Close()
// 赋值文件权限
e = dstFile.Chmod(f.Mode())
if e != nil {
return e
}
// 拷贝整个数据
_, e = io.Copy(dstFile, srcFile)
if e != nil {
Expand Down Expand Up @@ -148,6 +153,11 @@ func DeCompressGzip(gzipFile string, dstDir string) error {
return e
}
defer dstFile.Close()
// 赋值文件权限
e = dstFile.Chmod(h.FileInfo().Mode())
if e != nil {
return e
}
// 拷贝整个数据
_, e = io.Copy(dstFile, tr)
if e != nil {
Expand Down

0 comments on commit d5b5546

Please sign in to comment.