From ca7dae1e629785de7fbd5d293332ab5b062e3740 Mon Sep 17 00:00:00 2001 From: Aries Date: Wed, 4 Sep 2024 07:33:16 +0800 Subject: [PATCH] fix bug - open parent folder url error (#6703) --- .../metadata-view/components/context-menu/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/metadata/metadata-view/components/context-menu/index.js b/frontend/src/metadata/metadata-view/components/context-menu/index.js index fb8cc7dd64..79ec70c46e 100644 --- a/frontend/src/metadata/metadata-view/components/context-menu/index.js +++ b/frontend/src/metadata/metadata-view/components/context-menu/index.js @@ -130,7 +130,12 @@ const ContextMenu = ({ const { groupRecordIndex, rowIdx } = selectedPosition; const record = recordGetterByIndex({ isGroupView, groupRecordIndex, recordIndex: rowIdx }); if (!record) return; - const parentDir = record[PRIVATE_COLUMN_KEY.PARENT_DIR]; + let parentDir = record[PRIVATE_COLUMN_KEY.PARENT_DIR]; + + if (window.location.pathname.endsWith('/')) { + parentDir = parentDir.slice(1); + } + const url = window.location.origin + window.location.pathname + Utils.encodePath(parentDir); window.open(url, '_blank'); }, [isGroupView, recordGetterByIndex, selectedPosition]);