From 5f9073cb858c156210c2e5e6bc26d9c44c483488 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:00:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E6=96=87=E4=BB=B6=E8=A2=AB=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98=20(#3187)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs https://github.com/1Panel-dev/1Panel/issues/2961 --- backend/app/service/file.go | 7 +++++-- frontend/src/lang/modules/en.ts | 2 ++ frontend/src/lang/modules/tw.ts | 1 + frontend/src/lang/modules/zh.ts | 1 + .../src/views/host/file-management/delete/index.vue | 10 ++++++++-- frontend/src/views/website/runtime/php/param/index.vue | 1 + 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/backend/app/service/file.go b/backend/app/service/file.go index 71db41c89..dd9d792dd 100644 --- a/backend/app/service/file.go +++ b/backend/app/service/file.go @@ -251,8 +251,11 @@ func (f *FileService) MvFile(m request.FileMove) error { if !fo.Stat(m.NewPath) { return buserr.New(constant.ErrPathNotFound) } - for _, path := range m.OldPaths { - if path == m.NewPath || strings.Contains(m.NewPath, filepath.Clean(path)+"/") { + for _, oldPath := range m.OldPaths { + if !fo.Stat(oldPath) { + return buserr.WithName(constant.ErrFileNotFound, oldPath) + } + if oldPath == m.NewPath || strings.Contains(m.NewPath, filepath.Clean(oldPath)+"/") { return buserr.New(constant.ErrMovePathFailed) } } diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 37a9c5df5..206e9f81c 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1091,6 +1091,8 @@ const message = { fileRecycleBin: 'File Recycle Bin', fileRecycleBinMsg: '{0} recycle bin', wordWrap: 'Automatically wrap', + deleteHelper2: + 'Are you sure you want to delete the selected file? The deletion operation cannot be rolled back', }, ssh: { autoStart: 'Auto Start', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 458e4626d..d9a96c9b0 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1040,6 +1040,7 @@ const message = { fileRecycleBin: '檔案回收站', fileRecycleBinMsg: '已{0}回收站', wordWrap: '自動換行', + deleteHelper2: '確定刪除所選檔案? 刪除操作不可回滾', }, ssh: { autoStart: '開機自啟', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index b235e9ac9..832177a66 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1041,6 +1041,7 @@ const message = { fileRecycleBin: '文件回收站', fileRecycleBinMsg: '已{0}回收站', wordWrap: '自动换行', + deleteHelper2: '确定删除所选文件?删除操作不可回滚', }, ssh: { autoStart: '开机自启', diff --git a/frontend/src/views/host/file-management/delete/index.vue b/frontend/src/views/host/file-management/delete/index.vue index 60318e5b1..6bdfce4f6 100644 --- a/frontend/src/views/host/file-management/delete/index.vue +++ b/frontend/src/views/host/file-management/delete/index.vue @@ -3,9 +3,15 @@