diff --git a/packages/protocol/src/msg-push/rich-body-decoder.ts b/packages/protocol/src/msg-push/rich-body-decoder.ts index 759f5f8a..5d3e91cc 100644 --- a/packages/protocol/src/msg-push/rich-body-decoder.ts +++ b/packages/protocol/src/msg-push/rich-body-decoder.ts @@ -395,7 +395,7 @@ function bytesEqual(left: Uint8Array, right: Uint8Array): boolean { function isBigFaceCompatibilityText(extra: QFaceExtra, text: TextElem): boolean { const faceText = extra.text ?? ''; const reserveData = text.pbReserve; - if (!faceText.startsWith('/') || faceText.length === 1 || text.str !== faceText || !reserveData?.length) { + if (!faceText || text.str !== faceText || !reserveData?.length) { return false; } diff --git a/packages/protocol/tests/msg-push/rich-body-decoder.test.ts b/packages/protocol/tests/msg-push/rich-body-decoder.test.ts index c68a61ef..fc69ae75 100644 --- a/packages/protocol/tests/msg-push/rich-body-decoder.test.ts +++ b/packages/protocol/tests/msg-push/rich-body-decoder.test.ts @@ -594,6 +594,26 @@ describe('decodeRichBody / unknown wire element observability', () => { ]); }); + it.each(['/打call', '[蛇年快乐]', 'name'])('recognizes native compatibility text independently of the face label prefix (%s)', (faceText) => { + const reserve = protobuf_encode({ + str: `[${faceText.slice(1)}]请使用最新版手机QQ体验新功能`, + }); + const body: MessageBody = { + richText: { + elems: [ + { commonElem: { serviceType: 37, businessType: 3, + pbElem: protobuf_encode({ qsid: 429, text: faceText }) } } as never, + { text: { str: faceText, pbReserve: reserve } } as never, + { text: { str: faceText } } as never, + ], + }, + }; + expect(decodeRichBody(body, false)).toEqual([ + { type: 'face', faceId: 429 }, + { type: 'text', text: faceText }, + ]); + }); + it('[#289] preserves compatibility text when the big face has no valid face id', () => { const body: MessageBody = { richText: {