From ec372dbb988e3c9c79a8e6928c7169754107cf5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= <81747598+lan-yonghui@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:10:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E6=98=AF=E5=90=A6=E4=B8=BA=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=9A=84=E7=9B=AE=E5=BD=95=20(#7031)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/file.go | 8 +++++--- frontend/src/views/host/file-management/delete/index.vue | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/backend/app/service/file.go b/backend/app/service/file.go index f8f17b070..1d5b739b1 100644 --- a/backend/app/service/file.go +++ b/backend/app/service/file.go @@ -211,9 +211,11 @@ func (f *FileService) Create(op request.FileCreate) error { } func (f *FileService) Delete(op request.FileDelete) error { - excludeDir := global.CONF.System.DataDir - if strings.Contains(op.Path, ".1panel_clash") || op.Path == excludeDir { - return buserr.New(constant.ErrPathNotDelete) + if op.IsDir { + excludeDir := global.CONF.System.DataDir + if strings.Contains(op.Path, ".1panel_clash") || op.Path == excludeDir { + return buserr.New(constant.ErrPathNotDelete) + } } fo := files.NewFileOp() recycleBinStatus, _ := settingRepo.Get(settingRepo.WithByKey("FileRecycleBin")) diff --git a/frontend/src/views/host/file-management/delete/index.vue b/frontend/src/views/host/file-management/delete/index.vue index 00fda9a22..1ed065997 100644 --- a/frontend/src/views/host/file-management/delete/index.vue +++ b/frontend/src/views/host/file-management/delete/index.vue @@ -89,11 +89,11 @@ const getStatus = async () => { const onConfirm = async () => { const pros = []; for (const s of files.value) { - if (s['path'].indexOf('.1panel_clash') > -1) { - MsgWarning(i18n.global.t('file.clashDeleteAlert')); - return; - } if (s['isDir']) { + if (s['path'].indexOf('.1panel_clash') > -1) { + MsgWarning(i18n.global.t('file.clashDeleteAlert')); + return; + } const pathRes = await loadBaseDir(); if (s['path'] === pathRes.data) { MsgWarning(i18n.global.t('file.panelInstallDir'));