fix: web folders without list permission was offering in the menu a "download" link that cannot work
Massimo Melina committed
Jun 30, 2024 at 23:05 UTC
a8a67e3e84519b0ae485dcb7eca7b5fe4f63c834
1 file changed
+2
-1
frontend/src/fileMenu.ts
+2
-1
@@ -29,7 +29,8 @@ export function openFileMenu(entry: DirEntry, ev: MouseEvent, addToMenu: (FileMe
29
const { uri, isFolder, s } = entry
30
const canRead = !entry.p?.includes('r')
31
const canArchive = entry.p?.includes('A') || state.props?.can_archive && !entry.p?.includes('a')
32
- const cantDownload = entry.cantOpen || isFolder && !(canRead && canArchive) // folders needs list+read+archive
32
+ const canList = !entry.p?.match(/L/i)
33
+ const cantDownload = entry.cantOpen || isFolder && !(canRead && canArchive && canList) // folders needs list+read+archive
34
const menu = [
35
!cantDownload && { id: 'download', label: t`Download`, href: uri + (isFolder ? '?get=zip' : '?dl'), icon: 'download' },
36
state.props?.can_comment && { id: 'comment', label: t`Comment`, icon: 'comment', onClick: () => editComment(entry) },