diff --git a/backend/routers/issues.py b/backend/routers/issues.py index a9a270f6..ba2b42e1 100644 --- a/backend/routers/issues.py +++ b/backend/routers/issues.py @@ -215,6 +215,13 @@ async def create_issue( else: # Don't create new issue, just return deduplication info new_issue = None + + # Clean up uploaded file if it was discarded as duplicate + if image_path and os.path.exists(image_path): + try: + os.remove(image_path) + except OSError: + pass # Ignore cleanup errors except Exception as e: # Clean up uploaded file if DB save failed if image_path and os.path.exists(image_path):