diff --git a/system/Files/Exceptions/FileException.php b/system/Files/Exceptions/FileException.php index f16827f71361..e8950abc16db 100644 --- a/system/Files/Exceptions/FileException.php +++ b/system/Files/Exceptions/FileException.php @@ -10,14 +10,4 @@ public static function forUnableToMove(string $from = null, string $to = null, s return new static(lang('Files.cannotMove', [$from, $to, $error])); } - public static function forInvalidFilename(string $to = null) - { - return new self(lang('Files.invalidFilename', [$to])); - } - - public static function forCopyError(string $to = null) - { - return new self(lang('Files.cannotCopy', [$to])); - } - } diff --git a/system/Files/File.php b/system/Files/File.php index d5ecb325432f..f5c73ed00dc1 100644 --- a/system/Files/File.php +++ b/system/Files/File.php @@ -1,4 +1,5 @@ -getRealPath()); - finfo_close($finfo); - } - else - { - $mimeType = mime_content_type($this->getRealPath()); - } - + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $mimeType = finfo_file($finfo, $this->getRealPath()); + finfo_close($finfo); return $mimeType; } diff --git a/system/Language/en/Files.php b/system/Language/en/Files.php index 59bcbe65a415..e65396097961 100644 --- a/system/Language/en/Files.php +++ b/system/Language/en/Files.php @@ -14,8 +14,6 @@ */ return [ - 'fileNotFound' => 'File not found: {0}', - 'cannotMove' => 'Could not move file {0} to {1} ({2})', - 'invalidFilename' => 'Target filename missing or invalid: {0}', - 'cannotCopy' => 'Could not copy to {0} - make sure the folder is writeable', + 'fileNotFound' => 'File not found: {0}', + 'cannotMove' => 'Could not move file {0} to {1} ({2})', ];