8000 [Serializer] Fix DataUriNormalizer's regex by dunglas · Pull Request #20286 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Serializer] Fix DataUriNormalizer's regex #20286

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Serializer] Fix DataUriNormalizer's regex. Close #20225.
  • Loading branch information
dunglas committed Oct 25, 2016
commit c6346d9c7acec3891254956670458aaeef757aa2
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function supportsNormalization($data, $format = null)
*/
public function denormalize($data, $class, $format = null, array $context = array())
{
if (!preg_match('/^data:([a-z0-9]+\/[a-z0-9]+(;[a-z0-9\-]+\=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9\!\$\&\\\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i', $data)) {
if (!preg_match('/^data:([a-z0-9]+\/[a-z0-9\-\.\+]+(;[a-z0-9\-]+\=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9\!\$\&\\\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i', $data)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the - should be in the first part of mime also, to match types like x-conference/x-cooltalk

throw new UnexpectedValueException('The provided "data:" URI is not valid.');
}

Expand Down
Loading
0