Upgrade to latest Symfony HttpFoundation tag. Closes #1865.
This commit is contained in:
@@ -45,7 +45,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
|
||||
*/
|
||||
public static function isSupported()
|
||||
{
|
||||
return !defined('PHP_WINDOWS_VERSION_BUILD');
|
||||
return !defined('PHP_WINDOWS_VERSION_BUILD') && function_exists('passthru') && function_exists('escapeshellarg');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
|
||||
|
||||
$type = trim(ob_get_clean());
|
||||
|
||||
if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-]+)#i', $type, $match)) {
|
||||
if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-\.]+)#i', $type, $match)) {
|
||||
// it's not a type, but an error message
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\HttpFoundation\File\MimeType;
|
||||
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FileException;
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
|
||||
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
|
||||
|
||||
@@ -99,7 +98,9 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
|
||||
*
|
||||
* @return string The mime type or NULL, if none could be guessed
|
||||
*
|
||||
* @throws FileException If the file does not exist
|
||||
* @throws \LogicException
|
||||
* @throws FileNotFoundException
|
||||
* @throws AccessDeniedException
|
||||
*/
|
||||
public function guess($path)
|
||||
{
|
||||
|
||||
@@ -118,6 +118,19 @@ class UploadedFile extends File
|
||||
return $this->originalName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the original file extension
|
||||
*
|
||||
* It is extracted from the original file name that was uploaded.
|
||||
* Then is should not be considered as a safe value.
|
||||
*
|
||||
* @return string The extension
|
||||
*/
|
||||
public function getClientOriginalExtension()
|
||||
{
|
||||
return pathinfo($this->originalName, PATHINFO_EXTENSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the file mime type.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user