fix(ui): fall back to the default avatar when a profile image fails to load (#28270)
This commit is contained in:
1 file changed
+8
-1
@@ -6,7 +6,9 @@
|
|||||||
// LICENSE covers this Open WebUI fallback logo.
|
// LICENSE covers this Open WebUI fallback logo.
|
||||||
// Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
// Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||||
// https://docs.openwebui.com/license.
|
// https://docs.openwebui.com/license.
|
||||||
export let src = `${WEBUI_BASE_URL}/static/favicon.png`;
|
const FALLBACK_SRC = `${WEBUI_BASE_URL}/static/favicon.png`;
|
||||||
|
|
||||||
|
export let src = FALLBACK_SRC;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<img
|
<img
|
||||||
@@ -15,4 +17,9 @@
|
|||||||
class=" {className} object-cover rounded-2xl"
|
class=" {className} object-cover rounded-2xl"
|
||||||
alt="profile"
|
alt="profile"
|
||||||
draggable="false"
|
draggable="false"
|
||||||
|
on:error={(e) => {
|
||||||
|
if (!e.currentTarget.src.endsWith(FALLBACK_SRC)) {
|
||||||
|
e.currentTarget.src = FALLBACK_SRC;
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
Reference in new issue
Block a user