Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RomM/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ def download_rom(self) -> None:
)
if not catalogue_path:
continue
os.makedirs(catalogue_path, exist_ok=True)
Comment thread
gantoine marked this conversation as resolved.

filename = self._sanitize_filename(rom.fs_name_no_ext)
if rom.summary:
Expand Down
5 changes: 5 additions & 0 deletions RomM/imageutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Optional
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
from urllib.parse import urljoin

from PIL import Image, ImageDraw

Expand Down Expand Up @@ -54,6 +55,10 @@ def add_rounded_corners(self, image: Image.Image, radius: int = 20):

def load_image_from_url(self, url: str, headers: dict) -> Image.Image | None:
try:
# Use urljoin to properly resolve relative URLs against the host
if url:
url = urljoin(f'{self.host}/', url)

req = Request(url.split("?")[0], headers=headers)
with urlopen(req, timeout=60) as response: # trunk-ignore(bandit/B310)
data = response.read()
Expand Down
Loading