Skip to content

fix(css): quote urls with opening parenthesis#22496

Draft
Caltsic wants to merge 1 commit into
vitejs:mainfrom
Caltsic:fix/css-url-parentheses
Draft

fix(css): quote urls with opening parenthesis#22496
Caltsic wants to merge 1 commit into
vitejs:mainfrom
Caltsic:fix/css-url-parentheses

Conversation

@Caltsic
Copy link
Copy Markdown
Contributor

@Caltsic Caltsic commented May 22, 2026

Description

Fixes #19261.

Unquoted CSS url(...) values need wrapping after Vite rewrites them if the resulting URL contains parentheses. The existing check handled ), but an opening parenthesis can also make the rewritten unquoted URL invalid.

Tests

  • pnpm exec oxfmt --check packages/vite/src/node/plugins/css.ts playground/css/main.js playground/css/index.html playground/css/__tests__/tests.ts 'playground/css/url-with-(paren/index.css' 'playground/css/url-with-(paren/asset.txt'
  • pnpm exec eslint --cache --max-warnings 0 packages/vite/src/node/plugins/css.ts playground/css/__tests__/tests.ts
  • pnpm --filter vite build-bundle
  • pnpm --filter @vitejs/test-css build

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.

Failed to resolve the relative background image url in css when there're (/) in it's parent paths.

1 participant