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 () {