Author SHA1 Message Date
sneak b1b7ca00f1 next -> main (#149)
check / check (push) Successful in 7m37s
Reviewed-on: #149
2026-11-13 19:47:02 +01:00
3 changed files with 8 additions and 12 deletions

No files matched your search

-4
View File
@@ -545,10 +545,6 @@ need that fetch. An image whose first bytes libvips reads as another format is
refused with 415 too. An SVG whose first bytes pass the check for AVIF is one
example.
**Animated images.** pixa serves only the first frame of an animated GIF, WebP,
PNG or JPEG XL source. This holds in every output format, `orig` included. So an
animated GIF requested as GIF comes back as a still GIF.
**SVG sources.** `orig` of an SVG source is the SVG itself, unchanged, and is
cached like any other image. It is given only at the `orig` size, since pixa
does not resize an SVG as SVG. `orig` of an SVG at any other size is refused
@@ -52,7 +52,7 @@ const validTestSigningKey = "0123456789abcdef0123456789abcdef"
const signingKeyLine = "signing_key: " + validTestSigningKey + "\n"
// testHostS3 is an allowlist host entry used across the config tests.
const testHostS3 = "s3.example.com"
const testHostS3 = "s3.sneak.cloud"
// nullValueText is the substring that error messages about explicitly
// null config values must contain.
@@ -272,7 +272,7 @@ state_dir: /tmp/pixa-test-state
db_url: "file:/tmp/pixa-test-state/other.sqlite3"
signing_key: ` + validTestSigningKey + `
allowlist_hosts:
- s3.example.com
- s3.sneak.cloud
- .example.com
allow_http: true
upstream_connections_per_host: 5
@@ -306,7 +306,7 @@ metrics:
if len(c.AllowlistHosts) != 2 || c.AllowlistHosts[0] != testHostS3 ||
c.AllowlistHosts[1] != ".example.com" {
t.Errorf("AllowlistHosts = %v, want [s3.example.com .example.com]",
t.Errorf("AllowlistHosts = %v, want [s3.sneak.cloud .example.com]",
c.AllowlistHosts)
}
@@ -328,7 +328,7 @@ func TestCommaSeparatedAllowlistStillSupported(t *testing.T) {
t.Parallel()
yamlContent := signingKeyLine +
`allowlist_hosts: "s3.example.com, images.example.org"
`allowlist_hosts: "s3.sneak.cloud, sneak.berlin"
`
c, err := configFromYAML(t, yamlContent)
@@ -337,8 +337,8 @@ func TestCommaSeparatedAllowlistStillSupported(t *testing.T) {
}
if len(c.AllowlistHosts) != 2 || c.AllowlistHosts[0] != testHostS3 ||
c.AllowlistHosts[1] != "images.example.org" {
t.Errorf("AllowlistHosts = %v, want [s3.example.com images.example.org]",
c.AllowlistHosts[1] != "sneak.berlin" {
t.Errorf("AllowlistHosts = %v, want [s3.sneak.cloud sneak.berlin]",
c.AllowlistHosts)
}
}
+2 -2
View File
@@ -64,7 +64,7 @@ func TestEnvironmentSetsEveryKey(t *testing.T) {
t.Setenv("PIXA_METRICS_USERNAME", "metricsuser")
t.Setenv("PIXA_METRICS_PASSWORD", "metricspass")
t.Setenv("PIXA_SIGNING_KEY", validTestSigningKey)
t.Setenv("PIXA_ALLOWLIST_HOSTS", "s3.example.com,.example.com")
t.Setenv("PIXA_ALLOWLIST_HOSTS", "s3.sneak.cloud,.example.com")
t.Setenv("PIXA_REFERER_BLOCKLIST", "hotlinker.example,.leech.example")
t.Setenv("PIXA_ALLOW_HTTP", "true")
t.Setenv("PIXA_UPSTREAM_CONNECTIONS_PER_HOST", "5")
@@ -262,7 +262,7 @@ func TestListFromEnvironmentReplacesConfigFileList(t *testing.T) {
t.Setenv("PIXA_ALLOWLIST_HOSTS", " cdn.example.com , .example.org ")
c, err := configFromYAML(t, signingKeyLine+
"allowlist_hosts:\n - s3.example.com\n - images.example.org\n")
"allowlist_hosts:\n - s3.sneak.cloud\n - sneak.berlin\n")
if err != nil {
t.Fatalf("PIXA_ALLOWLIST_HOSTS should load: %v", err)
}