Take the signature, the expiry and the URL scheme off the image request (closes #314)
check / check (push) Canceled after 0s

The image request now holds only its source and its transform, exactly what
the variant key covers. The /v1/image/ handler checks the allowlist and
verifies the signature itself with Signer.Verify(req, sig, expires). Both
image handlers keep the URL's expiry as a local value for Cache-Control. The
image service holds no signer, allowlist or AllowHTTP, and ValidateRequest is
gone. The fetcher takes the source and builds its URL with Source.URL from its
own AllowHTTP, so no URL string is built and parsed again. chooseAutoFormat
returns the format it chooses instead of writing into the request. The signed
URL format and every route's answers are unchanged.

Model: opus-5-5
This commit was merged in pull request #331.
This commit is contained in:
2026-10-26 13:49:12 +01:00
parent 63690a9ec9
commit 7b6712538e
46 changed files with 770 additions and 925 deletions
+2 -3
View File
@@ -524,8 +524,7 @@ func signedImageURL(t *testing.T, sourceHost string) string {
Quality: 85,
FitMode: imagerequest.FitCover,
},
Expires: expires,
})
}, expires)
// Go's percent-encoding of a URL path writes the brackets of the IPv6
// host as %5B and %5D.
@@ -549,7 +548,7 @@ func encryptedImageURL(t *testing.T, sourceHost string) string {
token, err := generator.Generate(&imagerequest.Request{
Source: imagerequest.Source{Host: sourceHost, Path: ipv6SourcePath},
Transform: imagerequest.Transform{Format: imagerequest.FormatPNG},
})
}, time.Time{})
if err != nil {
t.Fatalf("encurl Generate: %v", err)
}