mirror of
https://github.com/LifeArchiveProject/WeChatDataAnalysis.git
synced 2026-02-03 06:20:51 +08:00
fix(chat): 图片消息优先使用包含 file_id 的本地 URL
- 当服务端返回本地 /api/chat/media/image URL 时,优先使用前端拼的本地 URL(携带 file_id),提高兜底命中率
This commit is contained in:
@@ -3292,7 +3292,14 @@ const normalizeMessage = (msg) => {
|
|||||||
].filter(Boolean)
|
].filter(Boolean)
|
||||||
return `${mediaBase}/api/chat/media/image?${parts.join('&')}`
|
return `${mediaBase}/api/chat/media/image?${parts.join('&')}`
|
||||||
})()
|
})()
|
||||||
const normalizedImageUrl = msg.imageUrl || localImageUrl || ''
|
const normalizedImageUrl = (() => {
|
||||||
|
const cur = (isUsableMediaUrl(msg.imageUrl) ? normalizeMaybeUrl(msg.imageUrl) : '')
|
||||||
|
// If backend already returns a local media endpoint, prefer the locally-built URL because it includes file_id.
|
||||||
|
if (cur && /\/api\/chat\/media\/image\b/i.test(cur) && localImageUrl) {
|
||||||
|
return localImageUrl
|
||||||
|
}
|
||||||
|
return cur || localImageUrl || ''
|
||||||
|
})()
|
||||||
const normalizedEmojiUrl = msg.emojiUrl || localEmojiUrl
|
const normalizedEmojiUrl = msg.emojiUrl || localEmojiUrl
|
||||||
const localVideoThumbUrl = (() => {
|
const localVideoThumbUrl = (() => {
|
||||||
if (!msg.videoThumbMd5 && !msg.videoThumbFileId) return ''
|
if (!msg.videoThumbMd5 && !msg.videoThumbFileId) return ''
|
||||||
|
|||||||
Reference in New Issue
Block a user