mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-09-22 08:00:53 +00:00
fix: 解决 zip 压缩在某些情况下失败的问题 (#2809)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user