diff options
author | Marc Alexander <admin@m-a-styles.de> | 2014-09-05 21:55:49 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2014-09-05 21:55:49 +0200 |
commit | 21029e9fd295bedfcc34555d32afd928a03392a1 (patch) | |
tree | 9e5a196841246bf15a6b442a0daa684f17691d4b /phpBB/phpbb/mimetype/guesser.php | |
parent | d31ff51785f42e3de255722a32f098ab49d1489c (diff) | |
download | forums-21029e9fd295bedfcc34555d32afd928a03392a1.tar forums-21029e9fd295bedfcc34555d32afd928a03392a1.tar.gz forums-21029e9fd295bedfcc34555d32afd928a03392a1.tar.bz2 forums-21029e9fd295bedfcc34555d32afd928a03392a1.tar.xz forums-21029e9fd295bedfcc34555d32afd928a03392a1.zip |
[ticket/13031] Slightly change behavior of choose_mime_type and add unit tests
The mime type 'application/octet-stream' will still always be overwritten by
proper guesses. However, guesses with guessers that have a higher priority
will now overwrite previous guesses even if the mime types of these guesses
had a slash in them.
PHPBB3-13031
Diffstat (limited to 'phpBB/phpbb/mimetype/guesser.php')
-rw-r--r-- | phpBB/phpbb/mimetype/guesser.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/phpBB/phpbb/mimetype/guesser.php b/phpBB/phpbb/mimetype/guesser.php index c019cb5b07..8baa77089b 100644 --- a/phpBB/phpbb/mimetype/guesser.php +++ b/phpBB/phpbb/mimetype/guesser.php @@ -131,22 +131,22 @@ class guesser * Choose the best mime type based on the current mime type and the guess * If a guesser returns nulls or application/octet-stream, we will keep * the current guess. Guesses with a slash inside them will be favored over - * already existing without slashes. However, any guess that will pass the - * first check will always overwrite the default application/octet-stream. + * already existing ones. However, any guess that will pass the first check + * will always overwrite the default application/octet-stream. * * @param string $mime_type The current mime type * @param string $guess The current mime type guess * * @return string The best mime type based on current mime type and guess */ - protected function choose_mime_type($mime_type, $guess) + public function choose_mime_type($mime_type, $guess) { if ($guess === null || $guess == 'application/octet-stream') { return $mime_type; } - if ((strpos($mime_type, '/') === false || $mime_type == 'application/octet-stream') && strpos($guess, '/') !== false) + if ($mime_type == 'application/octet-stream' || strpos($guess, '/') !== false) { $mime_type = $guess; } |