fix: _jar_to_dict prefers get_dict() to survive cross-domain cookie conflicts
the preview cookie map still used jar.items(), which raises curl_cffi CookieConflict when
the same cookie name lives on two domains - the blanket except then returned {}, so preview()
silently showed zero cookies in exactly the state ec1a20a adopted get_dict() to survive on
get_cookies. prefer get_dict() when the jar exposes it (hasattr-guarded), fall back to items()
for a plain mapping jar. preview-only; the items() path is unchanged for jars without get_dict.
Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -118,6 +118,10 @@ def _jar_to_dict(session):
|
||||
if not jar:
|
||||
return {}
|
||||
try:
|
||||
# prefer get_dict() where the jar exposes it: items() raises curl_cffi CookieConflict
|
||||
# when the same name lives on two domains, get_dict() flattens instead (mirrors get_cookies)
|
||||
if hasattr(jar, "get_dict"):
|
||||
return jar.get_dict()
|
||||
return {k: v for k, v in jar.items()}
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
Reference in New Issue
Block a user