@samitouri / QOSami-HFS / commits / d7364609

fix: admin/plugins: crash on malformed data #754

Massimo Melina committed Sep 27, 2024 at 12:43 UTC d73646093d0e59c0a05d4deda63a36443b3dd3fd
1 file changed +3 -3
admin/src/InstalledPlugins.ts
+3 -3
@@ -140,12 +140,12 @@ export function renderName({ row, value }: any) {
140 return h(Fragment, {},
141 errorIcon(row.error || row.badApi, !row.error),
142 repo?.includes('//') ? h(Link, { href: repo, target: 'plugin' }, value)
143 - : !repo ? value
144 - : with_(repo?.split('/'), arr => h(Fragment, {},
143 + : with_(repo?.split('/'), arr => arr?.length !== 2 ? value
144 + : h(Fragment, {},
145 h(Link, { href: 'https://github.com/' + repo, target: 'plugin', onClick(ev) { ev.stopPropagation() } }, arr[1].replace(/hfs-/, '')),
146 '\xa0by ', arr[0]
147 ))
148 - )
148 +)
149
150 function errorIcon(msg: string, warning=false) {
151 return msg && hTooltip(msg, msg, h(ErrorIcon, { fontSize: 'small', color: warning ? 'warning' : 'error', sx: { ml: -.5, mr: .5 } }))