Merge pull request #4155 from kinglozzer/pulls/getfiletype-case

FIX: File::getFileType() was case sensitive (fixes #3631)
This commit is contained in:
Daniel Hensby 2015-07-28 00:13:26 +01:00
commit 5f0d0ab66a
3 changed files with 6 additions and 1 deletions

View File

@ -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';
}

View File

@ -250,6 +250,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');
$this->assertEquals("unknown", $file->FileType);

View File

@ -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: