diff --git a/application/config/mimes.php b/application/config/mimes.php index d806f69246..dd4d337334 100644 --- a/application/config/mimes.php +++ b/application/config/mimes.php @@ -116,7 +116,7 @@ 'word' => array('application/msword', 'application/octet-stream'), 'xl' => 'application/excel', 'eml' => 'message/rfc822', - 'json' => array('application/json', 'text/json'), + 'json' => array('application/json', 'text/json', 'text/plain'), 'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'), 'p10' => array('application/x-pkcs10', 'application/pkcs10'), 'p12' => 'application/x-pkcs12', diff --git a/tests/codeigniter/libraries/Upload_test.php b/tests/codeigniter/libraries/Upload_test.php index 0d069d9a9d..c7f033dcba 100644 --- a/tests/codeigniter/libraries/Upload_test.php +++ b/tests/codeigniter/libraries/Upload_test.php @@ -195,6 +195,15 @@ function test_is_allowed_filetype() $this->assertTrue($this->upload->is_allowed_filetype(FALSE)); $this->assertTrue($this->upload->is_allowed_filetype(TRUE)); + $this->upload->allowed_types = array('json'); + $this->upload->file_ext = '.json'; + $this->upload->file_type = 'application/json'; + $this->assertTrue($this->upload->is_allowed_filetype(FALSE)); + + $this->upload->file_type = 'text/plain'; + $this->assertTrue($this->upload->is_allowed_filetype(FALSE)); + + $this->upload->allowed_types = array('html', 'gif'); $this->upload->file_temp = realpath(PROJECT_BASE.'tests/mocks/uploads/ci_logo.gif'); $this->upload->file_ext = '.gif'; $this->upload->file_type = 'image/gif';