mirror of
https://github.com/rommapp/romm.git
synced 2026-10-12 02:21:58 +00:00
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 <[email protected]> Claude-Session: https://claude.ai/code/session_014ficBAiEtYtZyBY8nWExKh
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user