Merge pull request #3305 from dato/export_catch_missing_key_icon

json_export: also detect absent "icon" key
This commit is contained in:
Mouse Reeve 2024-03-09 07:37:14 -08:00 committed by GitHub
commit 6dfb5000cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -80,10 +80,7 @@ def json_export(
exported_user = user.to_activity()
# I don't love this but it prevents a JSON encoding error
# when there is no user image
if isinstance(
exported_user["icon"],
dataclasses._MISSING_TYPE, # pylint: disable=protected-access
):
if exported_user.get("icon") in (None, dataclasses.MISSING):
exported_user["icon"] = {}
else:
# change the URL to be relative to the JSON file