From 77cb4a0c1bdaa081baf6e890313f503b2c30be00 Mon Sep 17 00:00:00 2001 From: itskovacs Date: Wed, 23 Jul 2025 18:18:41 +0200 Subject: [PATCH] :goal_net: Handle missing image file deletion --- backend/trip/utils/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/trip/utils/utils.py b/backend/trip/utils/utils.py index 61c9c80..f0dc72e 100644 --- a/backend/trip/utils/utils.py +++ b/backend/trip/utils/utils.py @@ -34,7 +34,10 @@ def b64img_decode(data: str) -> bytes: def remove_image(path: str): try: - Path(assets_folder_path() / path).unlink() + fpath = Path(assets_folder_path() / path) + if not fpath.exists(): + return + fpath.unlink() except OSError as exc: raise Exception("Error deleting image:", exc, path)