From a8581e488bec880ea9ab6c69a4819ab828985cde Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Jun 2026 19:13:09 +0000 Subject: [PATCH] Make HEAD endpoint consistent with GET: return 404 when files list is empty Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com> --- backend/endpoints/roms/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/endpoints/roms/__init__.py b/backend/endpoints/roms/__init__.py index 6374a4436..f31fcaf1b 100644 --- a/backend/endpoints/roms/__init__.py +++ b/backend/endpoints/roms/__init__.py @@ -868,6 +868,12 @@ async def head_rom_content( files = [f for f in files if f.id in file_id_values] files.sort(key=lambda x: x.file_name) + if not files: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail=f"No files found for ROM {id}", + ) + # Serve the file directly in development mode for emulatorjs if DEV_MODE: if len(files) == 1: