From 58fd806387e0e00367fa806eedba41f482f65114 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Thu, 11 Apr 2024 19:08:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=8B=E6=96=87=E4=BB=B6=E6=94=BE=E5=85=A5?= =?UTF-8?q?=E5=9B=9E=E6=94=B6=E7=AB=99=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#4480)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/utils/files/file_op.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/utils/files/file_op.go b/backend/utils/files/file_op.go index ca57a0288363..d1a526cc65ae 100644 --- a/backend/utils/files/file_op.go +++ b/backend/utils/files/file_op.go @@ -322,7 +322,7 @@ func (f FileOp) Cut(oldPaths []string, dst, name string, cover bool) error { coverFlag = "-f" } - cmdStr := fmt.Sprintf(`mv %s "%s" "%s"`, coverFlag, p, dstPath) + cmdStr := fmt.Sprintf(`mv %s '%s' '%s'`, coverFlag, p, dstPath) if err := cmd.ExecCmd(cmdStr); err != nil { return err } @@ -331,7 +331,7 @@ func (f FileOp) Cut(oldPaths []string, dst, name string, cover bool) error { } func (f FileOp) Mv(oldPath, dstPath string) error { - cmdStr := fmt.Sprintf(`mv "%s" "%s"`, oldPath, dstPath) + cmdStr := fmt.Sprintf(`mv '%s' '%s'`, oldPath, dstPath) if err := cmd.ExecCmd(cmdStr); err != nil { return err } @@ -385,13 +385,13 @@ func (f FileOp) CopyAndReName(src, dst, name string, cover bool) error { if name != "" && !cover { dstPath = filepath.Join(dst, name) } - return cmd.ExecCmd(fmt.Sprintf(`cp -rf "%s" "%s"`, src, dstPath)) + return cmd.ExecCmd(fmt.Sprintf(`cp -rf '%s' '%s'`, src, dstPath)) } else { dstPath := filepath.Join(dst, name) if cover { dstPath = dst } - return cmd.ExecCmd(fmt.Sprintf(`cp -f "%s" "%s"`, src, dstPath)) + return cmd.ExecCmd(fmt.Sprintf(`cp -f '%s' '%s'`, src, dstPath)) } } @@ -404,12 +404,12 @@ func (f FileOp) CopyDir(src, dst string) error { if err = f.Fs.MkdirAll(dstDir, srcInfo.Mode()); err != nil { return err } - return cmd.ExecCmd(fmt.Sprintf(`cp -rf "%s" "%s"`, src, dst+"/")) + return cmd.ExecCmd(fmt.Sprintf(`cp -rf '%s' '%s'`, src, dst+"/")) } func (f FileOp) CopyFile(src, dst string) error { dst = filepath.Clean(dst) + string(filepath.Separator) - return cmd.ExecCmd(fmt.Sprintf(`cp -f "%s" "%s"`, src, dst+"/")) + return cmd.ExecCmd(fmt.Sprintf(`cp -f '%s' '%s'`, src, dst+"/")) } func (f FileOp) GetDirSize(path string) (float64, error) {