summaryrefslogtreecommitdiff
path: root/server/szurubooru/func/posts.py
diff options
context:
space:
mode:
authorrr- <rr-@sakuya.pl>2017-01-25 17:10:19 +0100
committerrr- <rr-@sakuya.pl>2017-01-25 17:11:05 +0100
commit0cfc9bcafd716c736fab307cf02e3a34fa393cd5 (patch)
treef014e5ef5361aad9b747ba00a9f5854e631d4881 /server/szurubooru/func/posts.py
parent9b27e113b37ccefca54c682ac7cfdafc5beead46 (diff)
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.
Diffstat (limited to 'server/szurubooru/func/posts.py')
-rw-r--r--server/szurubooru/func/posts.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/server/szurubooru/func/posts.py b/server/szurubooru/func/posts.py
index 755090d..49f384c 100644
--- a/server/szurubooru/func/posts.py
+++ b/server/szurubooru/func/posts.py
@@ -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)