Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Joan Fabrégat committed Oct 9, 2018
1 parent 3b44b76 commit 628c9b0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/AssetsMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use CodeInc\AssetsMiddleware\Responses\AssetMinifiedResponse;
use CodeInc\AssetsMiddleware\Responses\NotModifiedAssetResponse;
use Micheh\Cache\CacheUtil;
use function PHPSTORM_META\elementType;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
Expand Down Expand Up @@ -171,8 +172,12 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
protected function isMediaTypeAllowed(AssetInterface $asset):bool
{
if (is_array($this->allowedMediaTypes)) {
return (bool)preg_grep('/^'.preg_quote($asset->getMediaType(), '/').'$/ui',
$this->allowedMediaTypes);
foreach ($this->allowedMediaTypes as $allowedMediaType) {
if (fnmatch($allowedMediaType, $asset->getMediaType())) {
return true;
}
}
return false;
}
return true;
}
Expand Down

0 comments on commit 628c9b0

Please sign in to comment.