From f828c375e6325583c2d5c0eea4230cd426dcdc62 Mon Sep 17 00:00:00 2001 From: rr- Date: Thu, 2 Feb 2017 21:52:52 +0100 Subject: [PATCH] server/posts: fix reverse search late evaluation Uploading webms caused 'Not an image.' error to be shown, cause generators are evaluated lazily, so the `catch` never worked. --- server/szurubooru/func/posts.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/szurubooru/func/posts.py b/server/szurubooru/func/posts.py index de58db0..51d11f3 100644 --- a/server/szurubooru/func/posts.py +++ b/server/szurubooru/func/posts.py @@ -553,11 +553,13 @@ def search_by_image_exact(image_content): def search_by_image(image_content): + ret = [] for result in image_hash.search_by_image(image_content): - yield PostLookalike( + ret.append(PostLookalike( score=result.score, distance=result.distance, - post=get_post_by_id(result.path)) + post=get_post_by_id(result.path))) + return ret def populate_reverse_search():