Fix: Strip whitespace from S3_PUBLIC_BASE_URL before building CDN URLs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 00:35:22 +00:00
parent 34d8c3848b
commit 35d21dafa4
2 changed files with 8 additions and 1 deletions

View File

@@ -30,7 +30,7 @@ def _error(detail: str, code: str, status: int):
def _image_to_dict(
image: Image, *, cdn_base: str | None = None, duplicate: bool | None = None
) -> dict[str, Any]:
_base = cdn_base.rstrip("/") if cdn_base else None
_base = cdn_base.strip().rstrip("/") if cdn_base else None
file_url = f"{_base}/{image.storage_key}" if _base else f"/api/v1/images/{image.id}/file"
thumbnail_url = (
(f"{_base}/{image.thumbnail_key}" if _base else f"/api/v1/images/{image.id}/thumbnail")