fix: fallback quoted image lookup by md5
This commit is contained in:
@@ -77,6 +77,10 @@ def parse_quote_message(xml_content: str) -> dict:
|
||||
quoted_content = _extract_first(r'<refermsg>.*?<content>(.*?)</content>', xml_content)
|
||||
ref_type = _extract_first(r'<refermsg>.*?<type>(.*?)</type>', xml_content)
|
||||
reference_svrid = _extract_first(r'<refermsg>.*?<svrid>(.*?)</svrid>', xml_content)
|
||||
reference_md5 = (
|
||||
_extract_first(r'md5="(.*?)"', html.unescape(quoted_content or ""))
|
||||
or _extract_first(r"<md5>(.*?)</md5>", html.unescape(quoted_content or ""))
|
||||
)
|
||||
pretty_reference = _format_referenced_content(ref_type, quoted_content, xml_content)
|
||||
media_preview = _extract_media_preview(ref_type, quoted_content)
|
||||
|
||||
@@ -85,6 +89,7 @@ def parse_quote_message(xml_content: str) -> dict:
|
||||
"display_name": display_name,
|
||||
"quoted_content": pretty_reference,
|
||||
"reference_svrid": reference_svrid,
|
||||
"reference_md5": reference_md5,
|
||||
"reference_type": media_preview.get("reference_type", "text"),
|
||||
"preview_image": media_preview.get("preview_image", ""),
|
||||
"preview_video_thumb": media_preview.get("preview_video_thumb", ""),
|
||||
|
||||
Reference in New Issue
Block a user