mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-21 11:18:08 +00:00
Fix avatar URL resolution in contact list: ensure full URL is used for non-relative avatar paths
This commit is contained in:
@@ -365,9 +365,19 @@ export default class PhoneChatUI {
|
||||
lastMessageTime = this.formatTimestamp(lastMessage.timestamp);
|
||||
}
|
||||
|
||||
// Resolve avatar path to full URL if relative
|
||||
let avatarSrc = npc.avatar;
|
||||
if (npc.avatar && !npc.avatar.startsWith('/') && !npc.avatar.startsWith('http')) {
|
||||
if (npc.avatar.startsWith('assets/')) {
|
||||
avatarSrc = `/break_escape/${npc.avatar}`;
|
||||
} else {
|
||||
avatarSrc = `${ASSETS_PATH}/${npc.avatar}`;
|
||||
}
|
||||
}
|
||||
|
||||
contactItem.innerHTML = `
|
||||
<div class="contact-avatar">
|
||||
${npc.avatar ? `<img src="${npc.avatar}" alt="${npc.displayName}">` : '👤'}
|
||||
${npc.avatar ? `<img src="${avatarSrc}" alt="${npc.displayName}">` : '👤'}
|
||||
</div>
|
||||
<div class="contact-info">
|
||||
<div class="contact-name">${npc.displayName || npc.id}</div>
|
||||
|
||||
Reference in New Issue
Block a user