fix(protocol): drop leftover picture copies in robot messages

Some group-bot pictures arrive twice: one working download and one
unusable leftover for older clients. Only the working picture is kept.

Fixes #389
This commit is contained in:
DrSmoothl committed 2026-08-17 20:08:48 +08:00
1 parent 86669d9451
commit 29e6baac72
3 files changed
+195 -2

No files matched your search

+7 -1
View File
@@ -13,7 +13,13 @@ export type DecompressDataResult =
export function makeImageUrl(origUrl: string): string {
if (!origUrl) return '';
if (origUrl.includes('rkey')) return 'https://multimedia.nt.qq.com.cn' + origUrl;
if (/^https?:\/\//i.test(origUrl)) return origUrl;
// Compatibility faces sometimes carry a query fragment without a path.
// Prefixing the host onto that produces an unusable URL.
if (!origUrl.startsWith('/')) return '';
if (origUrl.includes('rkey') || origUrl.includes('fileid')) {
return 'https://multimedia.nt.qq.com.cn' + origUrl;
}
return 'http://gchat.qpic.cn' + origUrl;
}