fix: file-menu not showing if a plugin returns undefined on fileMenu event

Massimo Melina committed Sep 12, 2025 at 21:51 UTC 0b6259e6073eba80ac3c7768d2f8d2e35d00d342
1 file changed +1 -1
frontend/src/fileMenu.ts
+1 -1
@@ -90,7 +90,7 @@ export async function openFileMenu(entry: DirEntry, ev: MouseEvent, addToMenu: (
90 isFolder && !entry.cantOpen && { id: 'folderSize', label: t`Size`, value: h(FolderSize) },
91 ].filter(Boolean)
92 const res = await Promise.all(hfsEvent('fileMenu', { entry, menu, props }))
93 - menu.push(...res.flat()) // flat because each plugin may return an array of entries
93 + menu.push(...res.flat().filter(Boolean)) // flat because each plugin may return an array of entries
94 _.remove(menu, (x, i) => _.find(menu, y => x.id ? x.id === y.id : (!y.id && x.label === y.label), i + 1)) // avoid duplicates, keeping later ones
95 const ico = getEntryIcon(entry)
96 const { close } = newDialog({