mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Ensure IconUrl from capabilities is a valid url
This commit is contained in:
parent
359e168ace
commit
abb0c7d2ca
1 changed files with 8 additions and 1 deletions
|
@ -63,7 +63,14 @@ export function getDeviceIcon(info: DeviceInfo | SessionInfo) {
|
|||
case 'Jellyfin Web':
|
||||
return getWebDeviceIcon((info as DeviceInfo).Name || (info as SessionInfo).DeviceName);
|
||||
default:
|
||||
return info.Capabilities?.IconUrl || BASE_DEVICE_IMAGE_URL + 'other.svg';
|
||||
if (info.Capabilities?.IconUrl) {
|
||||
try {
|
||||
return new URL(info.Capabilities.IconUrl).toString();
|
||||
} catch (err) {
|
||||
console.error('[getDeviceIcon] device capabilities has invalid IconUrl', info, err);
|
||||
}
|
||||
}
|
||||
return BASE_DEVICE_IMAGE_URL + 'other.svg';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue