uranusjr commented on code in PR #28777:
URL: https://github.com/apache/airflow/pull/28777#discussion_r1102508940
##########
airflow/utils/json.py:
##########
@@ -59,7 +59,11 @@ def default(self, o: Any) -> Any:
data = serialize(o)
if isinstance(data, dict) and DATA in data:
return data[DATA]
-
+ if isinstance(o, bytes):
+ try:
+ return o.decode()
+ except UnicodeDecodeError:
+ return repr(o)
Review Comment:
An alternative would be to use `o.decode("unicode_escape")`, which renders
undecodable characters as `\uXXXX`. This is probably better than leaking the
`b"..."` format.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]