Repository navigation
feat: bump imgproxy to v4 and adapt error mapping - #1788
Conversation
Signed-off-by: Ferhat Elmas <[email protected]>
There was a problem hiding this comment.
I reviewed this PR and didn't find any bugs. Every path is covered by the repo-wide CODEOWNERS entry, and the Accept-header change affects production requests as well as the local imgproxy bump, so a code owner should still take a look.
What was reviewed:
- The imgproxy v3-to-v4 env renames in docker-compose-infra.yml (timeouts, AUTO_WEBP, USE_LAST_MODIFIED, AVIF_SPEED).
sanitizeImgProxyAcceptHeader: it only changes the forwarded header. The cache-key format letters andVarystill come from the raw client Accept, and a header with only text/html sends no Accept.normalizeImgProxyErrorMessage: the stack trace is cut only at a blank line followed byfile.go:N, so multi-line v3 messages like the heif "bad seek" case still map as before. I also checked the broader source-format and timeout regexes against the new test cases.
Extended reasoning...
The change bumps the local imgproxy container to v4.0.26 and updates src/storage/renderer/image.ts. It now strips text/html from the Accept header forwarded to imgproxy, removes v4 development-mode stack traces from error bodies, and extends the regexes that map imgproxy errors. It doesn't touch auth, crypto or permissions, though it does change which headers production requests send to imgproxy. The bug hunt ran until it stopped finding issues (dry_streak) and reported nothing. I didn't approve because .github/CODEOWNERS assigns all paths to a code-owner team.
There was a problem hiding this comment.
🔵 Needs a closer look
The imgproxy upgrade requires live validation of v4 configuration, negotiated output, and development-error bodies, which mocked fixtures cannot establish while service execution is unavailable.
No open issues 🎉
What changed in this PR
Upgrades the shared local imgproxy service to v4.0.26 and adapts Storage’s image renderer to handle v4 error responses.
Changes:
- Updates imgproxy configuration for v4.
- Removes
text/htmlfrom forwarded Accept headers, strips error stack traces, and expands error mappings. - Adds renderer regression tests and clarifies an acceptance-test fixture comment.
| File | Description |
|---|---|
src/storage/renderer/image.ts |
Sanitizes Accept headers and normalizes v4 errors. |
src/storage/renderer/image.test.ts |
Tests header filtering and additional error responses. |
acceptance/specs/render.test.ts |
Updates the HEIF fixture comment; no behavior change. |
.docker/docker-compose-infra.yml |
Upgrades imgproxy and updates its configuration. |
Review effort: Balanced
Coverage Report for CI Build 46855304973Coverage increased (+0.003%) to 88.855%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
## What kind of change does this PR introduce? chore ## What is the current behavior? The acceptance test for rendering an invalid HEIF image always expects a 400 InvalidRequest response. ## What is the new behavior? The test uses `ACCEPTANCE_IMGPROXY_DEVELOPMENT_ERRORS_MODE` to choose the expected response respective imgproxy development error config. ## Additional context Related to #1788 Signed-off-by: Ferhat Elmas <[email protected]>
What kind of change does this PR introduce?
feat
What is the current behavior?
Local setup runs imgproxy
v3.26.Storage forwards the client full
Acceptheader and maps known imgproxy errors but some v4 error messages and development-mode stack traces do not match those mappings.What is the new behavior?
Local setup runs imgproxy
v4.0.26with updated configuration.Storage removes
text/htmlfrom theAcceptheader sent to imgproxy so development errors stay in a format it can interpret. It also strips stack traces before mapping errors and recognizes additional v4 invalid-image and timeout messages to return clearer controlled errors to clients.