From a3c4ae3b80054f9387d87f529eab9d45c5f119b3 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Thu, 19 May 2022 11:17:29 +0800 Subject: [PATCH] fix issue --- web_src/js/features/contexmenu.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web_src/js/features/contexmenu.js b/web_src/js/features/contexmenu.js index 23494d480..b357af71b 100644 --- a/web_src/js/features/contexmenu.js +++ b/web_src/js/features/contexmenu.js @@ -40,8 +40,9 @@ export default async function initContextMenu() { if (a.currentTarget.parentNode.nextElementSibling) { a.currentTarget.parentNode.style.setProperty('display', 'none', 'important') a.currentTarget.parentNode.nextElementSibling.style.display = 'table-row' - let renameFile = a.currentTarget.getElementsByTagName("a")[0].getAttribute('title') - a.currentTarget.parentNode.nextElementSibling.getElementsByTagName("input")[0].setAttribute("value", renameFile.substr(0, renameFile.indexOf('/'))) + const renameFile = a.currentTarget.getElementsByTagName("a")[0].getAttribute('title') + let renameFileValue = renameFile.indexOf('/') !== -1 ? renameFile.substr(0, renameFile.indexOf('/')) : renameFile + a.currentTarget.parentNode.nextElementSibling.getElementsByTagName("input")[0].setAttribute("value", renameFileValue) } let btn = a.currentTarget.parentNode.nextElementSibling.getElementsByTagName("button")[0]