mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 14:56:01 +00:00
fix the firmware endpoint
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from config import DISABLE_DOWNLOAD_ENDPOINT_AUTH, LIBRARY_BASE_PATH
|
||||
from config import DISABLE_DOWNLOAD_ENDPOINT_AUTH
|
||||
from decorators.auth import protected_route
|
||||
from endpoints.responses import MessageResponse
|
||||
from endpoints.responses.firmware import AddFirmwareResponse, FirmwareSchema
|
||||
@@ -154,7 +154,7 @@ def head_firmware_content(request: Request, id: int, file_name: str):
|
||||
log.error(error)
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=error)
|
||||
|
||||
firmware_path = f"{LIBRARY_BASE_PATH}/{firmware.full_path}"
|
||||
firmware_path = fs_firmware_handler.validate_path(firmware.full_path)
|
||||
|
||||
return FileResponse(
|
||||
path=firmware_path,
|
||||
@@ -192,7 +192,7 @@ def get_firmware_content(
|
||||
log.error(error)
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=error)
|
||||
|
||||
firmware_path = f"{LIBRARY_BASE_PATH}/{firmware.full_path}"
|
||||
firmware_path = fs_firmware_handler.validate_path(firmware.full_path)
|
||||
|
||||
return FileResponse(path=firmware_path, filename=firmware.file_name)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class FSFirmwareHandler(FSHandler):
|
||||
Args:
|
||||
platform: platform where firmware belong
|
||||
Returns:
|
||||
list with all the filesystem firmware for a platform found in the LIBRARY_BASE_PATH
|
||||
list with all the filesystem firmware for a platform
|
||||
"""
|
||||
firmware_path = self.get_firmware_fs_structure(platform_fs_slug)
|
||||
fs_firmware_files = self.list_files(path=firmware_path)
|
||||
|
||||
@@ -403,7 +403,7 @@ class FSRomsHandler(FSHandler):
|
||||
|
||||
rom_files.append(
|
||||
self._build_rom_file(
|
||||
f_path.relative_to(LIBRARY_BASE_PATH),
|
||||
f_path.relative_to(self.base_path),
|
||||
file_name,
|
||||
file_hash,
|
||||
)
|
||||
@@ -536,12 +536,12 @@ class FSRomsHandler(FSHandler):
|
||||
Args:
|
||||
platform: platform where roms belong
|
||||
Returns:
|
||||
list with all the filesystem roms for a platform found in the LIBRARY_BASE_PATH
|
||||
list with all the filesystem roms for a platform
|
||||
"""
|
||||
rel_roms_path = self.get_roms_fs_structure(
|
||||
platform.fs_slug
|
||||
) # Relative path to roms
|
||||
abs_fs_path = f"{LIBRARY_BASE_PATH}/{rel_roms_path}" # Absolute path to roms
|
||||
abs_fs_path = f"{self.base_path}/{rel_roms_path}" # Absolute path to roms
|
||||
|
||||
fs_single_roms = self.list_files(path=abs_fs_path)
|
||||
fs_multi_roms = self.list_directories(path=abs_fs_path)
|
||||
|
||||
Reference in New Issue
Block a user