Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
[BUGFIX] Scan files with extension svg and other mime-types
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoBlack committed May 10, 2020
1 parent e2fea03 commit fa6a35b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Classes/Service/SvgSanitizerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
*/
class SvgSanitizerService
{
protected $possibleMimeTypes = ['image/svg', 'image/svg+xml', 'application/svg', 'application/svg+xml'];

/**
* @param string $fileNameAndPath
* @return bool
Expand All @@ -39,7 +41,8 @@ class SvgSanitizerService
public function isSvgFile($fileNameAndPath)
{
$fileInfo = GeneralUtility::makeInstance(FileInfo::class, $fileNameAndPath);
return \in_array($fileInfo->getMimeType(), ['image/svg+xml', 'application/svg+xml'], true);
return $fileInfo->getExtension() === 'svg'
|| \in_array(strtolower($fileInfo->getMimeType()), $this->possibleMimeTypes, true);
}

/**
Expand Down

0 comments on commit fa6a35b

Please sign in to comment.