From 090ed9bf79e9f92f7287bcd2644e43e9cfd37de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Wed, 9 Aug 2017 02:42:22 +0200 Subject: [PATCH] [ticket/15276] Use finfo to get mimetype PHPBB3-15276 --- phpBB/phpbb/storage/adapter/local.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/storage/adapter/local.php b/phpBB/phpbb/storage/adapter/local.php index 34c2894569..2855dcf7d1 100644 --- a/phpBB/phpbb/storage/adapter/local.php +++ b/phpBB/phpbb/storage/adapter/local.php @@ -275,6 +275,16 @@ class local implements adapter_interface, stream_interface */ public function file_mimetype($path) { - return mime_content_type($this->root_path . $path); + if (class_exists('finfo')) + { + $finfo = new \finfo(FILEINFO_MIME_TYPE); + $mimetype = $finfo->file($this->root_path . $path); + } + else + { + $mimetype = mime_content_type($this->root_path . $path); + } + + return $mimetype; } }