mirror of https://github.com/1Panel-dev/1Panel
fix: 解决 zip 压缩在某些情况下失败的问题 (#2809)
parent
9d1757dba6
commit
cd5658adab
|
@ -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…
Reference in New Issue