Fix #1156 : Move mime detection hack to application level

This commit is contained in:
Romain Neutron
2013-05-05 13:20:44 +02:00
parent bbfecfaa7c
commit 0470d9b57c
2 changed files with 7 additions and 8 deletions

View File

@@ -18,8 +18,6 @@ use Silex\ControllerCollection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
use Symfony\Component\Serializer\Serializer;
/**
@@ -150,12 +148,6 @@ class Upload implements ControllerProviderInterface
*/
public function upload(Application $app, Request $request)
{
$guesser = MimeTypeGuesser::getInstance();
/**
* temporary hack to use this guesser before fileinfo
*/
$guesser->register(new FileBinaryMimeTypeGuesser());
$datas = array(
'success' => false,
'code' => null,

View File

@@ -14,6 +14,8 @@ namespace Alchemy\Phrasea;
use Alchemy\Phrasea\Core\Configuration;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
use Symfony\Component\Serializer;
use XPDF\PdfToText;
use XPDF\Exception\Exception as XPDFException;
@@ -148,6 +150,11 @@ class Core extends \Pimple
$this['mediavorus'] = $this->share(function() {
$guesser = MimeTypeGuesser::getInstance();
/**
* temporary hack to use this guesser before fileinfo
*/
$guesser->register(new FileBinaryMimeTypeGuesser());
return new \MediaVorus\MediaVorus();
});