Make one image URL per source on the generator page for host case and an empty path (closes #293)
check / check (push) Waiting to run

The generator page put the source host and path into the encrypted URL
as entered, so CDN.Example.com and cdn.example.com, or a source URL with
no path and with the path /, made two cache keys and two upstream
requests for one image. It now parses the source URL with the host
lower-cased and an empty path written as /, as /v1/image/ reads a
source URL, before the check that pixa fetches the URL as entered. That
is a small function of its own because HandleGenerateURL is at the
linter's length limit. The README says what the token keeps.

Model: opus-5-5
This commit is contained in:
2026-10-16 01:46:26 +00:00
parent 2bedd1dd03
commit 96b32dab3e
3 changed files with 30 additions and 4 deletions
+5 -3
View File
@@ -473,9 +473,11 @@ nor change what it asks for.
`jxl` for a form with no format.
The token holds the source's host, path and query and the size, format, quality,
fit and expiry, encrypted with a key derived from `signing_key`. The source
URL's scheme is not kept: the image is fetched like any other (see Routes), and
the blocked networks still apply.
fit and expiry, encrypted with a key derived from `signing_key`. The host is
kept in lower case and an empty path as `/`, as for `/v1/image/`, so
`https://CDN.Example.com` and `https://cdn.example.com/` are one source image,
fetched and cached once. The source URL's scheme is not kept: the image is
fetched like any other (see Routes), and the blocked networks still apply.
How long the URL lasts is chosen on the page, from 1 minute to 1 year, or never.
The expiry is fixed in the token when the URL is made and cannot be changed or