aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/functions_upload.php7
-rw-r--r--tests/functional/fileupload_form_test.php4
2 files changed, 8 insertions, 3 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index a0a67ccf3d..ae04fe737c 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -232,7 +232,12 @@ class filespec
{
if ($this->mimetype_guesser !== null)
{
- $this->mimetype = $this->mimetype_guesser->guess($filename);
+ $mimetype = $this->mimetype_guesser->guess($filename);
+
+ if (empty($this->mimetype) || $mimetype !== 'application/octet-stream')
+ {
+ $this->mimetype = $mimetype;
+ }
}
return $this->mimetype;
diff --git a/tests/functional/fileupload_form_test.php b/tests/functional/fileupload_form_test.php
index e87953367f..b8c48389e0 100644
--- a/tests/functional/fileupload_form_test.php
+++ b/tests/functional/fileupload_form_test.php
@@ -107,9 +107,9 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case
$crawler = $this->upload_file('disallowed.jpg', 'image/jpeg');
- // Hitting the ATTACHED_IMAGE_NOT_IMAGE error means we passed the
+ // Hitting the UNABLE_GET_IMAGE_SIZE error means we passed the
// DISALLOWED_CONTENT check
- $this->assertContains($this->lang('ATTACHED_IMAGE_NOT_IMAGE'), $crawler->text());
+ $this->assertContainsLang('UNABLE_GET_IMAGE_SIZE', $crawler->text());
}
public function test_too_large()