mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-19 10:24:50 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
6caf605fe2
commit
e01b06fb85
80 changed files with 173 additions and 218 deletions
|
@ -48,7 +48,6 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
|
||||
use SplFileInfo;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
|
||||
/**
|
||||
* This service provides functions to find attachments via an reverse search based on a file.
|
||||
|
|
|
@ -92,7 +92,7 @@ class FileTypeFilterTools
|
|||
foreach ($elements as $element) {
|
||||
$element = trim($element);
|
||||
if (!preg_match('#^\.\w+$#', $element) // .ext is allowed
|
||||
&& !preg_match('#^[-\w.]+\/[-\w.]+#', $element) //Explicit MIME type is allowed
|
||||
&& !preg_match('#^[-\w.]+/[-\w.]+#', $element) //Explicit MIME type is allowed
|
||||
&& !in_array($element, static::ALLOWED_MIME_PLACEHOLDERS, false)) { //image/* is allowed
|
||||
return false;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ class FileTypeFilterTools
|
|||
$element = 'video/*';
|
||||
} elseif ('audio' === $element || 'audio/' === $element) {
|
||||
$element = 'audio/*';
|
||||
} elseif (!preg_match('#^[-\w.]+\/[-\w.*]+#', $element) && 0 !== strpos($element, '.')) {
|
||||
} elseif (!preg_match('#^[-\w.]+/[-\w.*]+#', $element) && 0 !== strpos($element, '.')) {
|
||||
//Convert jpg to .jpg
|
||||
$element = '.'.$element;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ class FileTypeFilterTools
|
|||
$extensions = array_merge($extensions, static::AUDIO_EXTS);
|
||||
} elseif ('video/*' === $element) {
|
||||
$extensions = array_merge($extensions, static::VIDEO_EXTS);
|
||||
} elseif (preg_match('#^[-\w.]+\/[-\w.*]+#', $element)) {
|
||||
} elseif (preg_match('#^[-\w.]+/[-\w.*]+#', $element)) {
|
||||
$extensions = array_merge($extensions, $this->mimeTypes->getExtensions($element));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue