From 0cfc9bcafd716c736fab307cf02e3a34fa393cd5 Mon Sep 17 00:00:00 2001 From: rr- Date: Wed, 25 Jan 2017 17:10:19 +0100 Subject: [PATCH] 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. --- server/szurubooru/func/posts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)