fix: 解决 zip 压缩在某些情况下失败的问题 (#2809)

pull/2816/head
zhengkunwang 1 year ago committed by GitHub
parent 9d1757dba6
commit cd5658adab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -304,6 +304,14 @@ func (f FileOp) Cut(oldPaths []string, dst, name string, cover bool) error {
return nil
}
func (f FileOp) Mv(oldPath, dstPath string) error {
cmdStr := fmt.Sprintf("mv %s %s", oldPath, dstPath)
if err := cmd.ExecCmd(cmdStr); err != nil {
return err
}
return nil
}
func (f FileOp) Copy(src, dst string) error {
if src = path.Clean("/" + src); src == "" {
return os.ErrNotExist

@ -39,5 +39,5 @@ func (z ZipArchiver) Compress(sourcePaths []string, dstFile string) error {
if err := cmd.ExecCmdWithDir(cmdStr, baseDir); err != nil {
return err
}
return op.Rename(tmpFile, dstFile)
return op.Mv(tmpFile, dstFile)
}

Loading…
Cancel
Save