mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 19:47:14 +08:00
fix: handle UnicodeDecodeError if failed to decode base64 content with utf-8
This commit is contained in:
@@ -251,7 +251,12 @@ class HarParser(object):
|
|||||||
|
|
||||||
encoding = resp_content_dict.get("encoding")
|
encoding = resp_content_dict.get("encoding")
|
||||||
if encoding and encoding == "base64":
|
if encoding and encoding == "base64":
|
||||||
content = base64.b64decode(text).decode("utf-8")
|
content = base64.b64decode(text)
|
||||||
|
try:
|
||||||
|
content = content.decode("utf-8")
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
logger.warning(f"failed to decode base64 content with utf-8 !")
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
content = text
|
content = text
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user