Skip to content

Conversation

@danielroe
Copy link
Member

@danielroe danielroe commented Nov 3, 2025

πŸ”— Linked issue

closes #1268

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

this encodes ampersands in image uris for ipx

remake of #1268 by @riddla as I don't have permission to push to that branch

@cloudflare-workers-and-pages
Copy link

Deploying nuxt-image with Β Cloudflare Pages Β Cloudflare Pages

Latest commit: 178c5a0
Status:Β βœ…Β  Deploy successful!
Preview URL: https://d43e5445.nuxt-image.pages.dev
Branch Preview URL: https://feat-encode-reserved-charact.nuxt-image.pages.dev

View logs

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 3, 2025

Open in StackBlitz

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

commit: 178c5a0

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
βœ… Project coverage is 7.01%. Comparing base (356822d) to head (178c5a0).

Files with missing lines Patch % Lines
src/runtime/providers/ipx.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #2005      +/-   ##
========================================
- Coverage   7.02%   7.01%   -0.01%     
========================================
  Files         77      77              
  Lines       3575    3576       +1     
  Branches     138     138              
========================================
  Hits         251     251              
- Misses      3276    3277       +1     
  Partials      48      48              

β˜” View full report in Codecov by Sentry.
πŸ“’ 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.

@riddla
Copy link

riddla commented Nov 4, 2025

@danielroe, thank you for your work. I integrated your refactoring (locally) into my branch.

I think we might be encountering a bug in ipx – I pulled the latest ipx version locally and the 500 error seems to have to do with the order of the modifiers in the URL.

http://localhost:3001/embed%26f_webp%26s_400x400/picsum/id/237/600 does work, http://localhost:3001/q_20%26embed%26f_webp%26s_400x400/picsum/id/237/600 respectively using the quality modifier as the first modifier in the URL does trigger the 500 error (that you also encountered in the playground).

Screenshot 2025-11-04 at 09 51 49

(The error is only triggered, when I use the encoded ampersands, http://localhost:3001/q_20&embed&f_webp&s_400x400/picsum/id/237/600 is fine.)

Where should we go from here? File a bug over at https://github.com/unjs/ipx?

@danielroe
Copy link
Member Author

danielroe commented Nov 4, 2025

interesting. yes, in that case let's fix the issue in ipx

(or if it is as simple as sorting modifiers alphabetically we can do that in nuxt/image as a hotfix)

@danielroe
Copy link
Member Author

@riddla I investigated and the issue is that the decoding happens after splitting by modifier, which must be either & or ,. (and , can cause issues within srcset.

we could either open a PR to ipx to decode the entire string first, or possibly we might choose a different separator? @pi0 may have some thoughts here.

@pi0
Copy link
Member

pi0 commented Nov 4, 2025

if sorting can be a hotfix here would be great. in next major of IPX later we can change sep and make it configurable.

@riddla
Copy link

riddla commented Nov 4, 2025

Just for reference: I re-tested the Slack behavior regarding ampersands this morning with https://www.buescher.de/_ipx/fit_inside&f_jpg&s_1200x630/img/preview/home.jpg respectively https://www.buescher.de/_ipx/fit_inside%26f_jpg%26s_1200x630/img/preview/home.jpg.

There is still no preview for URLs using ampersands:
Screenshot 2025-11-04 at 11 04 01

riddla added a commit to tricks-gmbh/nuxt-image that referenced this pull request Nov 5, 2025
... and update test snapshots for consistency

nuxt#2005 (comment)
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.

5 participants