修复:前端 headface 引用统一 toLowerCase() 防止大写和 undefined

- 用户列表和发言头像引用加 .toLowerCase()
- 兼容 Redis 缓存中的旧 .GIF 大写数据
This commit is contained in:
2026-02-26 23:39:32 +08:00
parent a19ff20988
commit f92fae599e

View File

@@ -139,7 +139,7 @@
item.className = 'user-item';
item.dataset.username = username;
const headface = user.headface || '1.gif';
const headface = (user.headface || '1.gif').toLowerCase();
// VIP 图标和管理员标识
let badges = '';
if (user.vip_icon) {
@@ -284,7 +284,7 @@
// 获取发言者头像
const senderInfo = onlineUsers[msg.from_user];
const senderHead = (senderInfo && senderInfo.headface) || '1.gif';
const senderHead = ((senderInfo && senderInfo.headface) || '1.gif').toLowerCase();
const headImg =
`<img src="/images/headface/${senderHead}" style="display:inline;width:16px;height:16px;vertical-align:middle;margin-right:2px;" onerror="this.src='/images/headface/1.gif'">`;