mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #4155 from kinglozzer/pulls/getfiletype-case
FIX: File::getFileType() was case sensitive (fixes #3631)
This commit is contained in:
commit
5f0d0ab66a
@ -807,7 +807,7 @@ class File extends DataObject {
|
|||||||
'htm' => _t('File.HtmlType', 'HTML file')
|
'htm' => _t('File.HtmlType', 'HTML file')
|
||||||
);
|
);
|
||||||
|
|
||||||
$ext = $this->getExtension();
|
$ext = strtolower($this->getExtension());
|
||||||
|
|
||||||
return isset($types[$ext]) ? $types[$ext] : 'unknown';
|
return isset($types[$ext]) ? $types[$ext] : 'unknown';
|
||||||
}
|
}
|
||||||
|
@ -250,6 +250,9 @@ class FileTest extends SapphireTest {
|
|||||||
$file = $this->objFromFixture('File', 'pdf');
|
$file = $this->objFromFixture('File', 'pdf');
|
||||||
$this->assertEquals("Adobe Acrobat PDF file", $file->FileType);
|
$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 */
|
/* Only a few file types are given special descriptions; the rest are unknown */
|
||||||
$file = $this->objFromFixture('File', 'asdf');
|
$file = $this->objFromFixture('File', 'asdf');
|
||||||
$this->assertEquals("unknown", $file->FileType);
|
$this->assertEquals("unknown", $file->FileType);
|
||||||
|
@ -13,6 +13,8 @@ File:
|
|||||||
Filename: assets/FileTest.txt
|
Filename: assets/FileTest.txt
|
||||||
gif:
|
gif:
|
||||||
Filename: assets/FileTest.gif
|
Filename: assets/FileTest.gif
|
||||||
|
gifupper:
|
||||||
|
Filename: assets/FileTest.GIF
|
||||||
pdf:
|
pdf:
|
||||||
Filename: assets/FileTest.pdf
|
Filename: assets/FileTest.pdf
|
||||||
setfromname:
|
setfromname:
|
||||||
|
Loading…
Reference in New Issue
Block a user