mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/13031] Only use mimetype guesser guess if it helps us
If we already have a mimetype and the guesser's guess is the default fallback, we should keep the already existing mimetype the browser supplied. Otherwise, platforms that might not support mimetype guessers will cause us to always have the mimetype set to application/octet-stream on images. This will prevent users from uploading images. PHPBB3-13031
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user