Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broad data uri regex captures wrong ids in resolveId #18219

Closed
7 tasks done
jsudelko opened this issue Sep 27, 2024 · 0 comments · Fixed by #18241
Closed
7 tasks done

Broad data uri regex captures wrong ids in resolveId #18219

jsudelko opened this issue Sep 27, 2024 · 0 comments · Fixed by #18241
Labels
feat: build p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@jsudelko
Copy link

jsudelko commented Sep 27, 2024

Describe the bug

The data uri regex in

const dataUriRE = /^([^/]+\/[^;,]+)(;base64)?,([\s\S]*)$/

is too broad. It basically matches anything with a comma...continuing down to new URL('./foo.js?number=1,2,3') which is an invalid url.

Reproduction

https://regex101.com/r/oFvriu/2

Steps to reproduce

I couldn't do get the reproduction immediately trigger the data-uri plugin on vite.new and I'm not able to create a git repro right now. But it's a logic problem that's self-evident from just reading the code and seeing https://regex101.com/r/oFvriu/2.

Let me know if further info is needed.

System Info

not environment specific. logic bug.

Used Package Manager

pnpm

Logs

No response

Validations

@sapphi-red sapphi-red added p3-minor-bug An edge case that only affects very specific usage (priority) feat: build labels Sep 30, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: build p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants