From 4a42aa6fcddff9181284c52e2195dd6b40926964 Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@afi-sa.fr> Date: Mon, 29 Jul 2019 11:40:03 +0200 Subject: [PATCH] =?UTF-8?q?hotline#93504=20:=20Biblioth=C3=A8que=20num?= =?UTF-8?q?=C3=A9rique=20:=20pouvoir=20ouvrir/t=C3=A9l=C3=A9charger=20des?= =?UTF-8?q?=20images=20avec=20l'extension=20JPG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSIONS_HOTLINE/93504 | 1 + library/Class/File/Mime.php | 1 + tests/library/Class/File/MimeTest.php | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 VERSIONS_HOTLINE/93504 diff --git a/VERSIONS_HOTLINE/93504 b/VERSIONS_HOTLINE/93504 new file mode 100644 index 00000000000..64cc1ede359 --- /dev/null +++ b/VERSIONS_HOTLINE/93504 @@ -0,0 +1 @@ + - ticket #93504 : Bibliothèque numérique : pouvoir ouvrir/télécharger des images avec l'extension JPG \ No newline at end of file diff --git a/library/Class/File/Mime.php b/library/Class/File/Mime.php index c11e7b503d0..9c103908252 100644 --- a/library/Class/File/Mime.php +++ b/library/Class/File/Mime.php @@ -210,6 +210,7 @@ class Class_File_Mime { */ public static function getType($ext) { + $ext = strtolower($ext); if (isset(self::$extToTypes[$ext])) { return self::$extToTypes[$ext]; } diff --git a/tests/library/Class/File/MimeTest.php b/tests/library/Class/File/MimeTest.php index 9ee77a4b1b1..ce9ef17b76e 100644 --- a/tests/library/Class/File/MimeTest.php +++ b/tests/library/Class/File/MimeTest.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class MimeTest extends PHPUnit_Framework_TestCase { @@ -31,4 +31,10 @@ class MimeTest extends PHPUnit_Framework_TestCase { $this->assertEquals('application/javascript', Class_File_Mime::getType('js')); } + + /** @test */ + public function typeOfJPGShonuldBeImageJpg() { + $this->assertEquals('image/jpeg', Class_File_Mime::getType('JPG')); + } + } \ No newline at end of file -- GitLab