fix: 修复 issue #92 中的 4 个 bug

- fix(MomentsWindow): 修复朋友圈刷新崩溃问题
  - 新增 postsRef 追踪最新 posts 状态,避免触发重渲染
  - loadPosts 中改用 postsRef.current 读取数据
  - 从 useCallback 依赖数组移除 posts,断开依赖循环

- fix(exportService): 修复群聊导出数据串问题
  - 改进 findMessageTable 哈希匹配为大小写无关的精确匹配
  - 匹配失败返回 null,不再回退到第一个表

- fix(exportService): 修复导出 HTML 实体转义乱码问题
  - 增强 decodeHtmlEntities,支持   
 等常见实体
  - 对 content、senderDisplayName、formattedTime 字段解码

- fix(exportService): 修复红包/群收款显示原始 XML 问题
  - parseChatHistory 中过滤 datatype=2001 和 2002 的消息

- fix(htmlExportGenerator): 新增浏览器端二次解码兜底

关闭 #92
This commit is contained in:
ILoveBinglu
2026-03-18 11:27:11 +08:00
parent 9eae24e4e0
commit 6bf5c44080
3 changed files with 54 additions and 9 deletions
+10 -1
View File
@@ -878,10 +878,19 @@ body {
return 'c' + (Math.abs(hash) % 8);
}
// HTML 实体解码(防止导出数据中残留   等转义字符)
function decodeEntities(text) {
if (!text) return '';
const d = document.createElement('textarea');
d.innerHTML = text;
return d.value;
}
// HTML 转义
function esc(text) {
const decoded = decodeEntities(String(text || ''));
const d = document.createElement('div');
d.textContent = text;
d.textContent = decoded;
return d.innerHTML;
}