From bc28807aeb554f9ff5e7257663b22233437452fc Mon Sep 17 00:00:00 2001 From: Tomas Date: Thu, 2 Oct 2025 23:36:10 +0200 Subject: [PATCH 1/2] Fixed a typo --- py34/post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py34/post.py b/py34/post.py index b24afb3..d0e4b6e 100644 --- a/py34/post.py +++ b/py34/post.py @@ -65,7 +65,7 @@ class Post: except Exception as ex: exception = ex if self._image_data is None: - raise ex + raise exception return self._image_data From ee4ba5d5f2b33e84a1e8938712b0c02abc2d2f58 Mon Sep 17 00:00:00 2001 From: Tomas Date: Thu, 2 Oct 2025 23:40:33 +0200 Subject: [PATCH 2/2] Create file after the image was retrieved `post.get_image_data()` can throw, creating file and later calling the function can create empty "image" files, confusing the program. --- scraper/server/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scraper/server/__main__.py b/scraper/server/__main__.py index ce7152a..25ae609 100644 --- a/scraper/server/__main__.py +++ b/scraper/server/__main__.py @@ -124,8 +124,9 @@ def get_image(post_id: int = None): return send_file(path) else: post = py34.Post(entry.post, entry.dir, entry.image, entry.tags, entry.thumbnail) + image = post.get_image_data() with open(path, "wb") as file: - file.write(post.get_image_data()) + file.write(image) return send_file(path)