🐛 修复部分帖子解析异常

This commit is contained in:
BTMuli
2025-10-24 20:13:51 +08:00
parent 78c3f79bfd
commit 9020214d23
2 changed files with 4 additions and 1 deletions

View File

@@ -93,6 +93,7 @@ function getParsedText(data: TpTextType): Array<TpTextType> {
function getTpName(tp: TGApp.BBS.SctPost.Base): Component {
if (tp.children) return TpTexts;
if (typeof tp.insert === "undefined") return TpUnknown;
if (typeof tp.insert === "string") return TpText;
// game_user_info属于backup_text的一种必须放在backup_text判断的前面
if ("game_user_info" in tp.insert) return TpUid;

View File

@@ -286,7 +286,9 @@ async function getRenderPost(
jsonParse = data.post.structured_content;
}
}
return JSON.parse(jsonParse);
const res = JSON.parse(jsonParse);
if (!Array.isArray(res) && !res.insert) return [res];
return res;
}
async function parseContent(fullData: TGApp.BBS.Post.FullData): Promise<string> {