Skip to content

fix(ipx): resolve prerender 404s for encoded filenames #1378 - #2312

Open
blue-rigel wants to merge 3 commits into
nuxt:mainfrom
blue-rigel:fix/ipx-prerender-encoded-filenames
Open

fix(ipx): resolve prerender 404s for encoded filenames #1378#2312
blue-rigel wants to merge 3 commits into
nuxt:mainfrom
blue-rigel:fix/ipx-prerender-encoded-filenames

Conversation

@blue-rigel

@blue-rigel blue-rigel commented Aug 13, 2026

Copy link
Copy Markdown

🔗 Linked issue

📚 Description

Images with filenames contain non-URL-safe characters (e.g. +) fail during nuxt generate / prerender with IPX_FILE_NOT_FOUND.

❌ Problem

the IPX provider correctly encodes paths (+%2B), but Nitro prerender applies encodeURI() to routes, which re-encodes % (%2B%252B). IPX then looks up test%2Bplus.png instead of test+plus.png.

👍🏼 Solution

decodeURI(pathname) in the IPX route parseURL handler before parseIPXURL, so double-encoded paths resolve to the real source file. Also pass a base to new URL() for relative request URLs.

✅ Checklist

  • I have tested this change locally.
  • Regression coverage for + in filenames

🧪 Test plan

  1. Add an image with + in the name under public/
  2. Reference it with <NuxtImg>
  3. Run nuxt generate
  4. Confirm /_ipx/.../file%2B.... prerenders without IPX_FILE_NOT_FOUND and lands in .output/public/_ipx/

@blue-rigel
blue-rigel requested a review from danielroe as a code owner August 13, 2026 04:06
@pkg-pr-new

pkg-pr-new Bot commented Aug 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/image@2312

commit: 505a9fa

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 39bf481a-08ad-476f-9a1b-70b9e6479378

📥 Commits

Reviewing files that changed from the base of the PR and between a028236 and 505a9fa.

📒 Files selected for processing (1)
  • test/e2e/__snapshots__/ipx.json5
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/snapshots/ipx.json5

📝 Walkthrough

Walkthrough

The IPX URL parser now resolves relative URLs against http://localhost, decodes pathnames, and preserves undecoded pathnames when decoding fails. The playground includes a test+plus.png provider sample. End-to-end snapshots and static-generation expectations cover encoded requests, sources, and 300×300 and 600×600 generated outputs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Mergeability Score: ⚪ Minimal · up to 505a9

The PR adjusts encoded IPX path handling and adds regression coverage; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the IPX prerendering fix for encoded filenames and matches the main change.
Description check ✅ Passed The description explains the encoded-filename failure, the IPX parsing fix, and the regression coverage.
Linked Issues check ✅ Passed The changes decode double-encoded IPX paths, support relative URLs, and add regression coverage for plus signs, satisfying issue #1378.
Out of Scope Changes check ✅ Passed All code, sample, and snapshot changes support the IPX encoded-filename fix and its regression coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 32.61%. Comparing base (ac483b4) to head (505a9fa).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2312   +/-   ##
=======================================
  Coverage   32.61%   32.61%           
=======================================
  Files           7        7           
  Lines         371      371           
  Branches      131      131           
=======================================
  Hits          121      121           
  Misses        194      194           
  Partials       56       56           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

IPX_FILE_NOT_FOUND when using npm run build

2 participants