From f9a5537efc0038d10d1309c54bf214279907b6e4 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Jun 2026 14:36:09 +0000 Subject: [PATCH] fix(upload): store chunk temp dir under writable resources path Chunked ROM uploads created their temp directory directly under ROMM_BASE_PATH (/romm/tmp/uploads). The bare /romm directory is owned by the image's romm user (1000:1000, mode 755), so containers running with a custom UID/GID cannot create directories there, causing uploads to fail with "PermissionError: [Errno 13] Permission denied: '/romm/tmp'". Default the upload temp root to RESOURCES_BASE_PATH instead, which is a writable mounted volume in those setups (this is why manual uploads, which write under resources/, already worked). ROMM_TMP_PATH still overrides it. Fixes #3574 Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_014ficBAiEtYtZyBY8nWExKh --- backend/endpoints/roms/upload.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/endpoints/roms/upload.py b/backend/endpoints/roms/upload.py index 883dadb63..4c5089dab 100644 --- a/backend/endpoints/roms/upload.py +++ b/backend/endpoints/roms/upload.py @@ -8,7 +8,7 @@ from anyio import open_file from fastapi import Header, HTTPException, Request, status from starlette.responses import Response -from config import ROMM_BASE_PATH, ROMM_TMP_PATH +from config import RESOURCES_BASE_PATH, ROMM_TMP_PATH from decorators.auth import protected_route from handler.auth.constants import Scope from handler.database import db_platform_handler @@ -22,9 +22,12 @@ router = APIRouter( tags=["upload"], ) -# Store upload chunks under ROMM_BASE_PATH (disk-backed) by default. +# Store upload chunks under RESOURCES_BASE_PATH (disk-backed) by default. +# The bare ROMM_BASE_PATH is owned by the image's `romm` user, so containers +# running with a custom UID/GID cannot create directories directly under it. +# The resources directory is a writable, mounted volume in those setups. # Users can override the tmp location with the ROMM_TMP_PATH env variable. -_tmp_root = Path(ROMM_TMP_PATH) if ROMM_TMP_PATH else Path(ROMM_BASE_PATH) +_tmp_root = Path(ROMM_TMP_PATH) if ROMM_TMP_PATH else Path(RESOURCES_BASE_PATH) ROM_UPLOAD_TMP_BASE = _tmp_root / "tmp" / "uploads" ROM_UPLOAD_TTL = 86400 # 24 hours ROM_ASSEMBLY_CHUNK_SIZE = 8192 # 8KB read buffer during assembly