@samitouri / QOSami-HFS / commits / cc89fa32

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

Massimo Melina committed Sep 27, 2024 at 12:43 UTC cc89fa329ee7413aa2cfc26b98049a3fda2d2da6
1 file changed +3 -3
admin/src/InstalledPlugins.ts
+3 -3
@@ -143,12 +143,12 @@ export function renderName({ row, value }: any) {
143 row.downgrade && errorIcon("This version is older than the one you installed. It is possible that the author found a problem with your version and decided to retire it.", true),
144 errorIcon(row.error || row.badApi, !row.error),
145 repo?.includes('//') ? h(Link, { href: repo, target: 'plugin' }, value)
146 - : !repo ? value
147 - : with_(repo?.split('/'), arr => h(Fragment, {},
146 + : with_(repo?.split('/'), arr => arr?.length !== 2 ? value
147 + : h(Fragment, {},
148 h(Link, { href: 'https://github.com/' + repo, target: 'plugin', onClick(ev) { ev.stopPropagation() } }, arr[1].replace(/hfs-/, '')),
149 '\xa0by ', arr[0]
150 ))
151 - )
151 +)
152
153 function errorIcon(msg: string, warning=false) {
154 return msg && hTooltip(msg, msg, h(ErrorIcon, { fontSize: 'small', color: warning ? 'warning' : 'error', sx: { ml: -.5, mr: .5 } }))