From 2fd607a61a5c897083ff23f0ab7dcc0114e7a0c1 Mon Sep 17 00:00:00 2001 From: Yaro Kasear Date: Fri, 11 Jul 2025 14:28:43 -0500 Subject: [PATCH] Appeasing pylance. --- inventory/routes/images.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inventory/routes/images.py b/inventory/routes/images.py index 98da13b..18f1117 100644 --- a/inventory/routes/images.py +++ b/inventory/routes/images.py @@ -79,7 +79,10 @@ def delete_image(image_id): if not image: return jsonify({"success": False, "error": "Image not found"}) - abs_path = os.path.join(current_app.static_folder, image.filename.replace("\\", "/")) + rel_path = posixpath.normpath(str(image.filename)) + static_dir = str(current_app.static_folder) # appease the gods + abs_path = os.path.join(static_dir, rel_path) + if os.path.exists(abs_path): os.remove(abs_path)