You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "uranusjr (via GitHub)" <gi...@apache.org> on 2023/02/10 09:32:03 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #28777: Fix dag run conf encoding with non-JSON serializable values

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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org