fix: fix post type error

This commit is contained in:
H3CoF6
2026-02-13 23:42:06 +08:00
parent 7bf57a1475
commit 0a2d98b406
2 changed files with 10 additions and 9 deletions

View File

@@ -570,14 +570,13 @@ const getSnsMediaUrl = (post, m, idx, rawUrl) => {
const mid = String(m?.id || '').trim() const mid = String(m?.id || '').trim()
if (mid) parts.set('media_id', mid) if (mid) parts.set('media_id', mid)
const mtype = String(m?.type || '').trim() // const mtype = String(m?.type || '').trim()
if (mtype) parts.set('media_type', mtype) // if (mtype) parts.set('media_type', mtype)
const postType = String(post?.type || '1').trim()
if (postType) parts.set('post_type', postType)
// if (pick) parts.set('pick', pick)
// if (!pick && snsAvoidOtherPicked.value) {
// parts.set('avoid_picked', '1')
// parts.set('pv', String(snsMediaOverrideRev.value || '0'))
// }
if (md5) parts.set('md5', md5) if (md5) parts.set('md5', md5)
// Bump this when changing backend matching logic to avoid stale cached wrong images. // Bump this when changing backend matching logic to avoid stale cached wrong images.
parts.set('v', '7') parts.set('v', '7')

View File

@@ -105,6 +105,7 @@ def _parse_timeline_xml(xml_text: str, fallback_username: str) -> dict[str, Any]
if not xml_str: if not xml_str:
return out return out
try: try:
root = ET.fromstring(xml_str) root = ET.fromstring(xml_str)
except Exception: except Exception:
@@ -1143,7 +1144,8 @@ async def get_sns_media(
avoid_picked: int = 0, avoid_picked: int = 0,
post_id: Optional[str] = None, post_id: Optional[str] = None,
media_id: Optional[str] = None, media_id: Optional[str] = None,
media_type: int = 2, # media_type: int = 2,
post_type: int = 1,
pick: Optional[str] = None, pick: Optional[str] = None,
md5: Optional[str] = None, md5: Optional[str] = None,
url: Optional[str] = None, url: Optional[str] = None,
@@ -1152,7 +1154,7 @@ async def get_sns_media(
wxid_dir = _resolve_account_wxid_dir(account_dir) wxid_dir = _resolve_account_wxid_dir(account_dir)
if wxid_dir and post_id and media_id: if wxid_dir and post_id and media_id:
deterministic_key = _generate_sns_cache_key(post_id, media_id, media_type) deterministic_key = _generate_sns_cache_key(post_id, media_id, post_type)
exact_match_path = _resolve_sns_cached_image_path_by_cache_key( exact_match_path = _resolve_sns_cached_image_path_by_cache_key(
wxid_dir=wxid_dir, wxid_dir=wxid_dir,