mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 18:49:29 +08:00
fix: compatible with emoji/object icons in plugin card icon resolver (#33732)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user