Skip to content

Commit

Permalink
Make ActivityLog.json_data safe
Browse files Browse the repository at this point in the history
  • Loading branch information
rixx committed May 7, 2024
1 parent b07536b commit 70c8a98
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pretalx/common/models/log.py
@@ -1,5 +1,6 @@
import json
import logging
from contextlib import suppress

from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
Expand Down Expand Up @@ -53,7 +54,8 @@ def __str__(self):
@cached_property
def json_data(self):
if self.data:
return json.loads(self.data)
with suppress(json.JSONDecodeError):
return json.loads(self.data)
return {}

@cached_property
Expand Down

0 comments on commit 70c8a98

Please sign in to comment.