Fixed #393: Deal with errors unpacking focalPoint

This commit is contained in:
Andrew Godwin 2023-01-11 10:26:01 -07:00
parent d51a08ef8c
commit e20aea1b9c

View file

@ -812,7 +812,10 @@ class Post(StatorModel):
post.attachments.all().delete()
for attachment in get_list(data, "attachment"):
if "focalPoint" in attachment:
focal_x, focal_y = attachment["focalPoint"]
try:
focal_x, focal_y = attachment["focalPoint"]
except (ValueError, TypeError):
focal_x, focal_y = None, None
else:
focal_x, focal_y = None, None
mimetype = attachment.get("mediaType")