Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Fix allow data uri on img (#27)
Browse files Browse the repository at this point in the history
* Fix allow_data_uri on img tag breaking regular url

When allow_data_uri is set to true and allowed_hosts is kept at null the latter is converted to [null] which disallows all urls

* Dont override current list of allowedHosts
  • Loading branch information
martijnve authored and tgalopin committed Apr 5, 2019
1 parent 46e69ed commit 858f83a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Extension/Image/Sanitizer/ImgSrcSanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ public function sanitize(?string $input): ?string

if ($this->allowDataUri) {
$allowedSchemes[] = 'data';
$allowedHosts[] = null;
if (null !== $allowedHosts) {
$allowedHosts[] = null;
}
}

if (!$sanitized = $this->sanitizeUrl($input, $allowedSchemes, $allowedHosts, $this->forceHttps)) {
Expand Down

0 comments on commit 858f83a

Please sign in to comment.