Skip to content

Commit

Permalink
svg uploads (#38545)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianteeman committed Sep 14, 2022
1 parent f10f221 commit feca190
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions libraries/src/Helper/MediaHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,20 @@ public function canUpload($file, $component = 'com_media', $allowedExecutables =

$svgErrors = $sanitizer->getXmlIssues();

// We allow comments
/*
* We allow comments and temp fix for bugs in svg-santitizer
* https://github.com/darylldoyle/svg-sanitizer/issues/64
* https://github.com/darylldoyle/svg-sanitizer/issues/63
* https://github.com/darylldoyle/svg-sanitizer/pull/65
* https://github.com/darylldoyle/svg-sanitizer/issues/82
*/
foreach ($svgErrors as $i => $error) {
if ($error['message'] === 'Suspicious node \'#comment\'') {
if (
($error['message'] === 'Suspicious node \'#comment\'')
|| ($error['message'] === 'Suspicious attribute \'space\'')
|| ($error['message'] === 'Suspicious attribute \'enable-background\'')
|| ($error['message'] === 'Suspicious node \'svg\'')
) {
unset($svgErrors[$i]);
}
}
Expand Down

0 comments on commit feca190

Please sign in to comment.