fix: compatible with emoji/object icons in plugin card icon resolver (#33732)

This commit is contained in:
Will
2026-03-19 14:06:55 +08:00
committed by GitHub
parent 77b8012fd8
commit 0166cbf122

View File

@@ -21,12 +21,15 @@ const hasUrlProtocol = (value: string) => /^[a-z][a-z\d+.-]*:/i.test(value)
export const getPluginCardIconUrl = (
plugin: Pick<Plugin, 'from' | 'name' | 'org' | 'type'>,
icon: string | undefined,
icon: string | { content: string, background: string } | undefined,
tenantId: string,
) => {
if (!icon)
return ''
if (typeof icon === 'object')
return icon
if (hasUrlProtocol(icon) || icon.startsWith('/'))
return icon