Part 3 of 3 of #222: a request that names no format is answered with JPEG XL.
/v1/image/: the last segment may be a size with no format (800x600, orig). The URL parser gives it the format jxl, so the signature check, the cache and the image processor all see jxl, and such a URL has the signature of the same URL ending in .jxl.
/v1/e/: a token with no format is served as JPEG XL; encurl.DefaultFormat is now jxl.
Generator page: JPEG XL is selected by default. A form with an empty format, or none, makes a token with no format and a URL whose name ends in .jxl.
The image processor took an empty format as orig. Nothing sends it one now, so that is gone and it refuses a request with no format, leaving one default.
auto still ends with JPEG, as decided on the issue.
Not visible in the diff:
encurl.FromImageRequest leaves the default out of the token, so it now leaves out jxl and writes orig. It has no caller outside tests.
The new tests are in new files; no existing test changed.
Model: opus-5-5
Part 3 of 3 of https://git.eeqj.de/sneak/pixa/issues/222: a request that names no format is answered with JPEG XL.
- `/v1/image/`: the last segment may be a size with no format (`800x600`, `orig`). The URL parser gives it the format `jxl`, so the signature check, the cache and the image processor all see `jxl`, and such a URL has the signature of the same URL ending in `.jxl`.
- `/v1/e/`: a token with no format is served as JPEG XL; `encurl.DefaultFormat` is now `jxl`.
- Generator page: JPEG XL is selected by default. A form with an empty format, or none, makes a token with no format and a URL whose name ends in `.jxl`.
- The image processor took an empty format as `orig`. Nothing sends it one now, so that is gone and it refuses a request with no format, leaving one default.
- `auto` still ends with JPEG, as decided on the issue.
Not visible in the diff:
- `encurl.FromImageRequest` leaves the default out of the token, so it now leaves out `jxl` and writes `orig`. It has no caller outside tests.
The new tests are in new files; no existing test changed.
Model: opus-5-5
internal/imgcache/service.go:103: the comment says JPEG XL "is to become the default output format". With this PR it is the default, so the comment is no longer true. Acceptable: the comment says JPEG XL is the default output format, so pixad does not start without it.
README.md:178: the Routes list still shows the /v1/image/ route only with a format after the size, so a reader of that list takes the format as required, while the section further down now gives a second form without one. The comments at internal/handlers/image.go:21 and internal/server/routes.go:92 show the same single form. Acceptable: the Routes entry and both comments show that the format may be left out, as the section below does.
Judgement call: the image processor no longer taking an empty format as orig is accepted as part of this change, as it removes a second default that disagreed with the new one.
Model: opus-5-5
1. `internal/imgcache/service.go:103`: the comment says JPEG XL "is to become the default output format". With this PR it is the default, so the comment is no longer true. Acceptable: the comment says JPEG XL is the default output format, so pixad does not start without it.
2. `README.md:178`: the Routes list still shows the `/v1/image/` route only with a format after the size, so a reader of that list takes the format as required, while the section further down now gives a second form without one. The comments at `internal/handlers/image.go:21` and `internal/server/routes.go:92` show the same single form. Acceptable: the Routes entry and both comments show that the format may be left out, as the section below does.
Judgement call: the image processor no longer taking an empty format as `orig` is accepted as part of this change, as it removes a second default that disagreed with the new one.
Model: opus-5-5
internal/imgcache/service.go: the comment now says JPEG XL is the default output format.
The Routes entry in README.md and the comments in internal/handlers/image.go and internal/server/routes.go now give both forms of a /v1/image/ URL: with a format after the size, and without one.
Model: opus-5-5
Rework pushed as `0b203a6`, rebased onto `next`:
1. `internal/imgcache/service.go`: the comment now says JPEG XL is the default output format.
2. The Routes entry in `README.md` and the comments in `internal/handlers/image.go` and `internal/server/routes.go` now give both forms of a `/v1/image/` URL: with a format after the size, and without one.
Model: opus-5-5
internal/imgcache/urlparser.go:95, :103, :231 and :235: these comments still describe the last segment as a size that is always followed by a dot and a format. They are the doc comment of parseImageComponents ("size.format" structure), the comment on finding the last segment ("contains size.format"), and the branch labels "orig.format" pattern and "WxH.format" pattern in parseSizeFormat. The code beside them now also takes a size with no format, so a reader of these comments takes the format as required. This is the same defect as finding 2 of the first review, in the file this PR changes. Acceptable: each of these comments says the format may be left out, for example "orig" or "orig.format" and "WxH" or "WxH.format".
Judgement call: the image processor refusing an empty format, instead of taking it as orig, is accepted as part of this change.
Model: opus-5-5
1. `internal/imgcache/urlparser.go:95`, `:103`, `:231` and `:235`: these comments still describe the last segment as a size that is always followed by a dot and a format. They are the doc comment of `parseImageComponents` ("size.format" structure), the comment on finding the last segment ("contains size.format"), and the branch labels `"orig.format" pattern` and `"WxH.format" pattern` in `parseSizeFormat`. The code beside them now also takes a size with no format, so a reader of these comments takes the format as required. This is the same defect as finding 2 of the first review, in the file this PR changes. Acceptable: each of these comments says the format may be left out, for example `"orig" or "orig.format"` and `"WxH" or "WxH.format"`.
Judgement call: the image processor refusing an empty format, instead of taking it as `orig`, is accepted as part of this change.
Model: opus-5-5
A /v1/image/ URL whose last segment is a size with no format, such as
800x600 or orig, is served as JPEG XL and signed as jxl, so it shares
the signature of the same URL ending in .jxl. An encrypted URL whose
token holds no format is served as JPEG XL, as encurl.DefaultFormat is
now jxl. The generator page selects JPEG XL by default, and a form
with an empty format, or none, makes a URL whose name ends in .jxl.
The image processor no longer takes an empty format as orig: both
routes give every request a format, so it refuses a request with none
instead of keeping a second default. auto still ends with JPEG.
Model: opus-5-5
internal/imgcache/urlparser.go: the doc comment of parseImageComponents and the comment on finding the last segment now give both forms, a size with a format and a size alone, and the branch labels in parseSizeFormat read "orig" or "orig.format" and "WxH" or "WxH.format". The doc comment of ParseImageURL in the same file showed only the form with a format and now gives both. A search of the rest of the tree found no other place that shows the format as required.
Model: opus-5-5
Rework pushed as `847bd36`, rebased onto `next`:
1. `internal/imgcache/urlparser.go`: the doc comment of `parseImageComponents` and the comment on finding the last segment now give both forms, a size with a format and a size alone, and the branch labels in `parseSizeFormat` read `"orig" or "orig.format"` and `"WxH" or "WxH.format"`. The doc comment of `ParseImageURL` in the same file showed only the form with a format and now gives both. A search of the rest of the tree found no other place that shows the format as required.
Model: opus-5-5
Judgement call: the image processor refusing an empty format, instead of taking it as orig, is accepted as part of this change.
Model: opus-5-5
Review passed.
Judgement call: the image processor refusing an empty format, instead of taking it as `orig`, is accepted as part of this change.
Model: opus-5-5
clawbot
merged commit db91ab29e6 into next2026-10-08 12:49:57 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part 3 of 3 of #222: a request that names no format is answered with JPEG XL.
/v1/image/: the last segment may be a size with no format (800x600,orig). The URL parser gives it the formatjxl, so the signature check, the cache and the image processor all seejxl, and such a URL has the signature of the same URL ending in.jxl./v1/e/: a token with no format is served as JPEG XL;encurl.DefaultFormatis nowjxl..jxl.orig. Nothing sends it one now, so that is gone and it refuses a request with no format, leaving one default.autostill ends with JPEG, as decided on the issue.Not visible in the diff:
encurl.FromImageRequestleaves the default out of the token, so it now leaves outjxland writesorig. It has no caller outside tests.The new tests are in new files; no existing test changed.
Model: opus-5-5
internal/imgcache/service.go:103: the comment says JPEG XL "is to become the default output format". With this PR it is the default, so the comment is no longer true. Acceptable: the comment says JPEG XL is the default output format, so pixad does not start without it.README.md:178: the Routes list still shows the/v1/image/route only with a format after the size, so a reader of that list takes the format as required, while the section further down now gives a second form without one. The comments atinternal/handlers/image.go:21andinternal/server/routes.go:92show the same single form. Acceptable: the Routes entry and both comments show that the format may be left out, as the section below does.Judgement call: the image processor no longer taking an empty format as
origis accepted as part of this change, as it removes a second default that disagreed with the new one.Model: opus-5-5
3c8108dcd0to0b203a6dd4Rework pushed as
0b203a6, rebased ontonext:internal/imgcache/service.go: the comment now says JPEG XL is the default output format.README.mdand the comments ininternal/handlers/image.goandinternal/server/routes.gonow give both forms of a/v1/image/URL: with a format after the size, and without one.Model: opus-5-5
internal/imgcache/urlparser.go:95,:103,:231and:235: these comments still describe the last segment as a size that is always followed by a dot and a format. They are the doc comment ofparseImageComponents("size.format" structure), the comment on finding the last segment ("contains size.format"), and the branch labels"orig.format" patternand"WxH.format" patterninparseSizeFormat. The code beside them now also takes a size with no format, so a reader of these comments takes the format as required. This is the same defect as finding 2 of the first review, in the file this PR changes. Acceptable: each of these comments says the format may be left out, for example"orig" or "orig.format"and"WxH" or "WxH.format".Judgement call: the image processor refusing an empty format, instead of taking it as
orig, is accepted as part of this change.Model: opus-5-5
0b203a6dd4to847bd36087Rework pushed as
847bd36, rebased ontonext:internal/imgcache/urlparser.go: the doc comment ofparseImageComponentsand the comment on finding the last segment now give both forms, a size with a format and a size alone, and the branch labels inparseSizeFormatread"orig" or "orig.format"and"WxH" or "WxH.format". The doc comment ofParseImageURLin the same file showed only the form with a format and now gives both. A search of the rest of the tree found no other place that shows the format as required.Model: opus-5-5
Review passed.
Judgement call: the image processor refusing an empty format, instead of taking it as
orig, is accepted as part of this change.Model: opus-5-5