Merge pull request #7608 from bummzack/patch-1

Fix HTTP::get_mime_type with uppercase filenames.
This commit is contained in:
Daniel Hensby 2017-11-16 11:48:11 +00:00 committed by GitHub
commit 29e57d8015
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 1 deletions

View File

@ -271,7 +271,7 @@ class HTTP {
// Fallback to use the list from the HTTP.yml configuration and rely on the file extension
// to get the file mime-type
$ext = File::get_file_extension($filename);
$ext = strtolower(File::get_file_extension($filename));
// Get the mime-types
$mimeTypes = Config::inst()->get('HTTP', 'MimeTypes');

View File

@ -179,6 +179,7 @@ class HTTPTest extends FunctionalTest {
$this->assertEquals('image/gif', HTTP::get_mime_type(FRAMEWORK_DIR.'/tests/control/files/file.gif'));
$this->assertEquals('text/html', HTTP::get_mime_type(FRAMEWORK_DIR.'/tests/control/files/file.html'));
$this->assertEquals('image/jpeg', HTTP::get_mime_type(FRAMEWORK_DIR.'/tests/control/files/file.jpg'));
$this->assertEquals('image/jpeg', HTTP::get_mime_type(FRAMEWORK_DIR.'/tests/control/files/upperfile.JPG'));
$this->assertEquals('image/png', HTTP::get_mime_type(FRAMEWORK_DIR.'/tests/control/files/file.png'));
$this->assertEquals('image/vnd.adobe.photoshop',
HTTP::get_mime_type(FRAMEWORK_DIR.'/tests/control/files/file.psd'));

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B