fix: clicking on last breadcrumb, folder-menu had faulty folder link
Massimo Melina committed
Jun 10, 2024 at 00:36 UTC
b82397d9b7ec9908bdf25ed9bf3ecbf0635d6f59
1 file changed
+2
-2
frontend/src/fileMenu.ts
+2
-2
@@ -59,7 +59,7 @@ export function openFileMenu(entry: DirEntry, ev: MouseEvent, addToMenu: (FileMe
59
state.props?.can_delete && { id: 'cut', label: t`Cut`, icon: 'cut', onClick: () => close(cut([entry])) },
60
isFolder && !entry.web && { id: 'list', label: t`Get list`, href: uri + '?get=list&folders=*', icon: 'list' },
61
]
62
- const folder = entry.n.slice(0, -entry.name.length - 1)
62
+ const folder = entry.n.slice(0, -entry.name.length - (entry.isFolder ? 2 : 1))
63
const props = [
64
{ id: 'name', label: t`Name`, value: entry.name },
65
typeof s === 'number' && { id: 'size', label: t`Size`,
@@ -69,7 +69,7 @@ export function openFileMenu(entry: DirEntry, ev: MouseEvent, addToMenu: (FileMe
69
id: 'folder',
70
label: t`Folder`,
71
value: h(Link, {
72
- to: location.pathname + folder + '/',
72
+ to: (folder.startsWith('/') ? '' : location.pathname) + folder + '/',
73
onClickCapture: () => closeDialog(null, true)
74
}, folder.replaceAll('/', ' / '))
75
},