From 0470d9b57c673bd7672da9d21ec1c577b1105dea Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Sun, 5 May 2013 13:20:44 +0200 Subject: [PATCH] Fix #1156 : Move mime detection hack to application level --- lib/Alchemy/Phrasea/Controller/Prod/Upload.php | 8 -------- lib/Alchemy/Phrasea/Core.php | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php index eee83ecb43..e3d0e67300 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php @@ -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, diff --git a/lib/Alchemy/Phrasea/Core.php b/lib/Alchemy/Phrasea/Core.php index 5e3812bb31..10bb325bed 100644 --- a/lib/Alchemy/Phrasea/Core.php +++ b/lib/Alchemy/Phrasea/Core.php @@ -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(); });