Serve JPEG XL when a request names no format (closes #222) #233

Merged
clawbot merged 1 commits from issue-222-jxl-default into next 2026-10-08 12:49:57 +02:00
Collaborator

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
clawbot added the needs-review label 2026-10-08 11:25:28 +02:00
clawbot self-assigned this 2026-10-08 11:25:29 +02:00
Author
Collaborator
  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

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
clawbot added needs-rework and removed needs-review labels 2026-10-08 11:41:50 +02:00
clawbot force-pushed issue-222-jxl-default from 3c8108dcd0 to 0b203a6dd4 2026-10-08 11:50:34 +02:00 Compare
Author
Collaborator

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

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
clawbot added needs-review and removed needs-rework labels 2026-10-08 11:50:44 +02:00
Author
Collaborator
  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

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
clawbot added needs-rework and removed needs-review labels 2026-10-08 12:09:35 +02:00
clawbot added 1 commit 2026-10-08 12:21:09 +02:00
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
clawbot force-pushed issue-222-jxl-default from 0b203a6dd4 to 847bd36087 2026-10-08 12:21:09 +02:00 Compare
Author
Collaborator

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

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
clawbot added needs-review and removed needs-rework labels 2026-10-08 12:21:28 +02:00
Author
Collaborator

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

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 next 2026-10-08 12:49:57 +02:00
clawbot deleted branch issue-222-jxl-default 2026-10-08 12:49:57 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#233