Compare commits

..
2 Commits
Author SHA1 Message Date
clawbot e1f6155322 Refuse SVG at the fetcher and never save an unknown input as JPEG (part of #68)
check / check (push) Successful in 17m6s
The fetcher no longer accepts image/svg+xml, so an SVG source gets the
refusal every unaccepted upstream type gets, which both image routes now
answer with 415 where they answered 500. orig of an input the processor
cannot name is ErrUnsupportedInputFormat, also answered 415, where it
was saved as JPEG. README.md drops SVG from the source formats and lists
the 415.

Model: opus-5-5
2026-10-13 01:51:56 +00:00
clawbot c5f318033d Test that an SVG source and orig of an unnamed input are refused
Failing tests, ahead of the fix: an upstream answering image/svg+xml is
answered 415 on the image route, also for orig; both image routes answer
415 for an unaccepted upstream content type and for orig of an input the
processor cannot name; and the processor refuses orig of a TIFF instead
of saving it as JPEG.

Model: opus-5-5
2026-10-13 01:51:55 +00:00
2 changed files with 3 additions and 3 deletions

No files matched your search

@@ -36,7 +36,7 @@ func TestUnsupportedSourceFormatAnswers415(t *testing.T) {
h.handleImageError(encrypted, err)
for route, rec := range map[string]*httptest.ResponseRecorder{
"/v1/image/": plain, "/v1/e/": encrypted,
"HandleImage": plain, "HandleImageEnc": encrypted,
} {
t.Logf("%s for %v: %d %s", route, err, rec.Code, rec.Body.String())
+2 -2
View File
@@ -8,7 +8,7 @@ import (
)
// TestImageProxyRefusesSVG requests an image the upstream answers as SVG,
// at its own size and format and resized as PNG, through pixa's router,
// in its own format (orig) and resized as PNG, through pixa's router,
// upstream fetcher and image processor. pixa does not accept SVG as a
// source, so each request is answered 415, never with an image.
func TestImageProxyRefusesSVG(t *testing.T) {
@@ -24,7 +24,7 @@ func TestImageProxyRefusesSVG(t *testing.T) {
s, _, _ := startImageProxy(t, upstream)
for _, sizeFormat := range []string{"orig.orig", "32x24.png"} {
for _, sizeFormat := range []string{"64x48.orig", "32x24.png"} {
target := "/v1/image/" + upstreamHost + "/drawing.svg/" + sizeFormat
rec := httptest.NewRecorder()