Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-mw committed Jul 8, 2022
1 parent b39736f commit d35e691
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/MicroweberPackages/App/functions/plupload.php
Expand Up @@ -563,17 +563,25 @@
}

} else if ($ext === 'svg') {

$valid = false;
if (is_file($filePath)) {
$sanitizer = new \enshrined\svgSanitize\Sanitizer();
// Load the dirty svg
$dirtySVG = file_get_contents($filePath);
// Pass it to the sanitizer and get it back clean
$cleanSVG = $sanitizer->sanitize($dirtySVG);
file_put_contents($filePath, $cleanSVG);
try {
$cleanSVG = $sanitizer->sanitize($dirtySVG);
$valid = true;
} catch (\Exception $e) {
$valid = false;
}

if ($valid) {
file_put_contents($filePath, $cleanSVG);
}

}
$valid = true;


} else {
$valid = false;
Expand Down

0 comments on commit d35e691

Please sign in to comment.