server/posts: fix handling corrupt files

In case of a ProcessingError, the image dimensions are set to None. But
after that, they are compared with 0, which resulted in a TypeError.
This commit is contained in:
rr- 2017-01-25 17:10:19 +01:00
parent 9b27e113b3
commit 0cfc9bcafd
1 changed files with 2 additions and 1 deletions

View File

@ -334,7 +334,8 @@ def update_post_content(post, content):
except errors.ProcessingError:
post.canvas_width = None
post.canvas_height = None
if post.canvas_width <= 0 or post.canvas_height <= 0:
if (post.canvas_width is not None and post.canvas_width <= 0) \
or (post.canvas_height is not None and post.canvas_height <= 0):
post.canvas_width = None
post.canvas_height = None
setattr(post, '__content', content)