diff --git a/filesystem/File.php b/filesystem/File.php index ca0b51c9e..8f5124220 100644 --- a/filesystem/File.php +++ b/filesystem/File.php @@ -808,7 +808,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 1466810a8..750479ad5 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 636339f15..47e5190aa 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: