From 588895d851b85097d5cdba7612452af173065d82 Mon Sep 17 00:00:00 2001 From: Jaime Idolpx Date: Tue, 16 Jun 2026 16:49:22 -0400 Subject: [PATCH] feat(SearchCSDbNG): enhance image fetching by resolving links and updating file extension handling --- src/app/components/SearchCSDbNG.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/components/SearchCSDbNG.tsx b/src/app/components/SearchCSDbNG.tsx index d3b3539..3f2cc31 100644 --- a/src/app/components/SearchCSDbNG.tsx +++ b/src/app/components/SearchCSDbNG.tsx @@ -175,11 +175,13 @@ export default function SearchCSDbNG({ config, setConfig, onClose }: SearchCSDbN if (release?.ScreenShot?.[0]) { setMountProgress(p => p && { ...p, phase: 'image' }); try { - const imgRes = await fetch(release.ScreenShot[0]); + let imgPath = release.ScreenShot[0]; + try { imgPath = new URL(imgPath).pathname; } catch { /* already a path */ } + const imgRes = await fetch(resolveLink(imgPath)); if (imgRes.ok) { const imgData = await imgRes.arrayBuffer(); const mainBase = fname.replace(/\.[^.]+$/, ''); - const imgExt = release.ScreenShot[0].split('.').pop()?.split('?')[0]?.toLowerCase() ?? 'png'; + const imgExt = imgPath.split('.').pop()?.split('?')[0]?.toLowerCase() ?? 'png'; await putFileContents(joinPath(DOWNLOAD_DIR, `${mainBase}.${imgExt}`), imgData); } } catch { /* non-fatal */ }