Skip to content

fix(assets): avoid splitting , inside base64 value of srcset attribute#15422

Merged
sapphi-red merged 7 commits intovitejs:mainfrom
chaejunlee:srcset-base64
Dec 30, 2023
Merged

fix(assets): avoid splitting , inside base64 value of srcset attribute#15422
sapphi-red merged 7 commits intovitejs:mainfrom
chaejunlee:srcset-base64

Conversation

@chaejunlee
Copy link
Contributor

fixes #15419

Description

As mentioned in the issue, when parsing srcset, the , inside base64 value was getting split and joined again, breaking the base64 encoding.

The comment of splitSrcSet says that it is handling "data:..." case. But RE itself is only catching single or double quotes. I added additional RE logic to capture the whole base64 values.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines, especially the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Update the corresponding documentation if needed.
  • Ideally, include relevant tests that fail without this PR but pass with it.

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@chaejunlee chaejunlee changed the title fix: escape splitting , inside base64 value within srcset attribute of img fix(utils): escape splitting , inside base64 value within srcset attribute of img Dec 25, 2023
@chaejunlee chaejunlee changed the title fix(utils): escape splitting , inside base64 value within srcset attribute of img fix(node): escape splitting , inside base64 value within srcset attribute of img Dec 25, 2023
@bluwy bluwy changed the title fix(node): escape splitting , inside base64 value within srcset attribute of img fix(assets): avoid splitting , inside base64 value of srcset attribute Dec 26, 2023
@bluwy bluwy added the p3-minor-bug An edge case that only affects very specific usage (priority) label Dec 26, 2023
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Looks great 👍

@sapphi-red sapphi-red merged commit 8de7bd2 into vitejs:main Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p3-minor-bug An edge case that only affects very specific usage (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

srcset with base64 value is mangled on build

4 participants