Skip to content

Commit

Permalink
Fix conent type static files
Browse files Browse the repository at this point in the history
  • Loading branch information
puleeno committed Jan 13, 2024
1 parent 27b8322 commit a8f6418
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/Http/Controllers/StaticFileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public function __invoke(RequestInterface $request, ResponseInterface $response,
$pagePath = $request->getUri()->getPath();
$assetFile = get_path('root') . str_replace('/', DIRECTORY_SEPARATOR, $pagePath);

header('Content-Type:' . $this->getContentTypeFromFileName(basename($pagePath)));

$response = $response->withHeader('Content-Type', $this->getContentTypeFromFileName(basename($pagePath)));
$response->getBody()->write(file_get_contents($assetFile));

Expand Down

0 comments on commit a8f6418

Please sign in to comment.