Permalink
Browse files

detecting the mimetype of static files by their name, closes #95

  • Loading branch information...
philiplb committed Jan 31, 2018
1 parent ffb7b3b commit ffd60cee12b7a85999b42a44a54a13bcc8e97a7b
Showing with 4 additions and 5 deletions.
  1. +1 −0 CHANGELOG.md
  2. +3 −5 src/CRUDlex/ControllerProvider.php
@@ -4,6 +4,7 @@ CRUDlex Changelog
## 0.13.0
Released: Upcoming
- The soft deletion is now optional (but switched on by default)
- Fixed content type of static files by detecting the mimetype by their name
## 0.12.0
Released: 2017-08-22
@@ -11,8 +11,7 @@
namespace CRUDlex;
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
use League\Flysystem\Util\MimeType;
use Silex\Api\ControllerProviderInterface;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
@@ -600,9 +599,8 @@ public function staticFile(Request $request, Application $app)
return $this->getNotFoundPage($app, $app['translator']->trans('crudlex.resourceNotFound'));
}
$filesystem = new Filesystem(new Local(dirname($file)));
$mimeType = $filesystem->getMimetype(basename($file));
$size = filesize($file);
$mimeType = MimeType::detectByFilename($file);
$size = filesize($file);
$streamedFileResponse = new StreamedFileResponse();
$response = new StreamedResponse($streamedFileResponse->getStreamedFileFunction($file), 200, [

0 comments on commit ffd60ce

Please sign in to comment.