Skip to content

Commit

Permalink
Revert "Revert "Dev: Don't rely on exif extension to check if file is…
Browse files Browse the repository at this point in the history
… an image - use finfo instead""

This reverts commit 8736469.
  • Loading branch information
olleharstedt committed Feb 12, 2020
1 parent b657ac9 commit fdea9ca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion application/controllers/admin/LimeSurveyFileManager.php
Expand Up @@ -482,14 +482,15 @@ private function _collectFileList($folderPath)
}

$files = scandir($realPath);
$finfo = finfo_open(FILEINFO_MIME_TYPE);

foreach ($files as $file) {
if ($file == '.' || $file == '..') {continue;}

$fileRelativePath = $folderPath . DIRECTORY_SEPARATOR . $file;
$fileRealpath = dirname(Yii::app()->basePath) . DIRECTORY_SEPARATOR . $fileRelativePath;
$fileIsDirectoy = @is_dir($fileRealpath);
$isImage = @exif_imagetype($fileRealpath) !== false;
$isImage = strpos(finfo_file($finfo, $fileRealpath), 'image') !== false;
if ($fileIsDirectoy) {
continue;
} else {
Expand Down

0 comments on commit fdea9ca

Please sign in to comment.