Fix image export in container and skip already-local URLs
Mount frontend/public into the api container so the export can write badge/sprite images. Skip re-downloading URLs that are already local paths from a previous export. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -425,6 +425,14 @@ def _download_image(
|
|||||||
|
|
||||||
Returns the local path (relative to frontend/public).
|
Returns the local path (relative to frontend/public).
|
||||||
"""
|
"""
|
||||||
|
# Already a local path — check the file exists, otherwise re-derive the path
|
||||||
|
if url.startswith("/"):
|
||||||
|
local = FRONTEND_PUBLIC / url.lstrip("/")
|
||||||
|
if local.exists():
|
||||||
|
return url
|
||||||
|
# File missing — can't re-download without the original URL, keep as-is
|
||||||
|
return url
|
||||||
|
|
||||||
url_ext = url.rsplit(".", 1)[-1].split("?")[0].lower()
|
url_ext = url.rsplit(".", 1)[-1].split("?")[0].lower()
|
||||||
if url_ext in ("png", "jpg", "jpeg", "gif", "webp", "svg"):
|
if url_ext in ("png", "jpg", "jpeg", "gif", "webp", "svg"):
|
||||||
ext = f".{url_ext}"
|
ext = f".{url_ext}"
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./backend/src:/app/src:cached
|
- ./backend/src:/app/src:cached
|
||||||
- ./backend/alembic.ini:/app/alembic.ini:cached
|
- ./backend/alembic.ini:/app/alembic.ini:cached
|
||||||
|
- ./frontend/public:/frontend/public
|
||||||
environment:
|
environment:
|
||||||
- DEBUG=true
|
- DEBUG=true
|
||||||
- DATABASE_URL=postgresql://postgres:postgres@db:5432/nuzlocke
|
- DATABASE_URL=postgresql://postgres:postgres@db:5432/nuzlocke
|
||||||
|
|||||||
Reference in New Issue
Block a user