diff --git a/filesystem/File.php b/filesystem/File.php index 466c906ad..a31a640cb 100644 --- a/filesystem/File.php +++ b/filesystem/File.php @@ -807,7 +807,7 @@ class File extends DataObject { 'htm' => _t('File.HtmlType', 'HTML file') ); - $ext = $this->getExtension(); + $ext = strtolower($this->getExtension()); return isset($types[$ext]) ? $types[$ext] : 'unknown'; } diff --git a/tests/filesystem/FileTest.php b/tests/filesystem/FileTest.php index efd74e304..d5ff9c0e8 100644 --- a/tests/filesystem/FileTest.php +++ b/tests/filesystem/FileTest.php @@ -249,6 +249,9 @@ class FileTest extends SapphireTest { $file = $this->objFromFixture('File', 'pdf'); $this->assertEquals("Adobe Acrobat PDF file", $file->FileType); + + $file = $this->objFromFixture('File', 'gifupper'); + $this->assertEquals("GIF image - good for diagrams", $file->FileType); /* Only a few file types are given special descriptions; the rest are unknown */ $file = $this->objFromFixture('File', 'asdf'); diff --git a/tests/filesystem/FileTest.yml b/tests/filesystem/FileTest.yml index 58d9b13ef..daf2bfd32 100644 --- a/tests/filesystem/FileTest.yml +++ b/tests/filesystem/FileTest.yml @@ -13,6 +13,8 @@ File: Filename: assets/FileTest.txt gif: Filename: assets/FileTest.gif + gifupper: + Filename: assets/FileTest.GIF pdf: Filename: assets/FileTest.pdf setfromname: