From cf8aa86a67748828c74cd0b1acce682aea956c88 Mon Sep 17 00:00:00 2001 From: trom <107225647+see-more@users.noreply.github.com> Date: Mon, 2 Sep 2024 10:35:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B7=AF=E5=BE=84bug=20(#6313)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix:修复文件路径bug * fix:修改文件路径逻辑 --- frontend/src/views/host/file-management/index.vue | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index 3d5b89dea..2cbb34e59 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -550,6 +550,11 @@ const top = () => { }; const jump = async (url: string) => { + const fileName = url.substring(url.lastIndexOf('/') + 1); + let filePath = url.substring(0, url.lastIndexOf('/') + 1); + if (!url.includes('.')) { + filePath = url; + } history.splice(pointer + 1); history.push(url); pointer = history.length - 1; @@ -558,7 +563,7 @@ const jump = async (url: string) => { const oldPageSize = req.pageSize; // reset search params before exec jump Object.assign(req, initData()); - req.path = url; + req.path = filePath; req.containSub = false; req.search = ''; req.pageSize = oldPageSize; @@ -571,6 +576,14 @@ const jump = async (url: string) => { MsgWarning(i18n.global.t('commons.res.notFound')); return; } + if (fileName && fileName.length > 1 && fileName.includes('.')) { + const fileData = searchResult.data.items.filter((item) => item.name === fileName); + if (fileData && fileData.length === 1) { + openView(fileData[0]); + } else { + MsgWarning(i18n.global.t('commons.res.notFound')); + } + } handleSearchResult(searchResult); getPaths(req.path); nextTick(function () {