Skip to content

feat: bump imgproxy to v4 and adapt error mapping - #1788

Merged
ferhatelmas merged 1 commit into
masterfrom
ferhat/img-v4
Dec 2, 2026
Merged

ferhatelmas merged 1 commit into
masterfrom
ferhat/img-v4

Conversation

@ferhatelmas

Copy link
Copy Markdown
Member

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 Accept header 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.26 with updated configuration.
Storage removes text/html from the Accept header 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.

@ferhatelmas
ferhatelmas requested a review from a team as a code owner December 2, 2026 09:51
Copilot AI balanced review requested due to automatic review settings December 2, 2026 09:51

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 and Vary still 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 by file.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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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/html from 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

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 46855304973

Coverage increased (+0.003%) to 88.855%

Details

  • Coverage increased (+0.003%) from the base build.
  • Patch coverage: 10 of 10 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 19644
Covered Lines: 17980
Line Coverage: 91.53%
Relevant Branches: 12361
Covered Branches: 10458
Branch Coverage: 84.6%
Branches in Coverage %: Yes
Coverage Strength: 1276.61 hits per line

💛 - Coveralls

@ferhatelmas
ferhatelmas merged commit 8df875b into master Dec 2, 2026
41 checks passed
@ferhatelmas
ferhatelmas deleted the ferhat/img-v4 branch December 2, 2026 10:05
ferhatelmas added a commit that referenced this pull request Dec 2, 2026
## 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants