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() post.attachments.all().delete()
for attachment in get_list(data, "attachment"): for attachment in get_list(data, "attachment"):
if "focalPoint" in attachment: if "focalPoint" in attachment:
try:
focal_x, focal_y = attachment["focalPoint"] focal_x, focal_y = attachment["focalPoint"]
except (ValueError, TypeError):
focal_x, focal_y = None, None
else: else:
focal_x, focal_y = None, None focal_x, focal_y = None, None
mimetype = attachment.get("mediaType") mimetype = attachment.get("mediaType")