From 42b76d0d1930e6a9887cbcd54d25a01d92b035ff Mon Sep 17 00:00:00 2001 From: Aleksander Kowalski Date: Thu, 5 May 2022 19:14:26 +0200 Subject: [PATCH] #85 - fix bug for show content a other browsers (#97) * fix: bug for show other browsers * fix: after review * fix: after review * fix: after review Co-authored-by: aleksander.kowalski --- resources/views/layouts/app.blade.php | 2 +- src/Http/Controllers/StaticController.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index ab96610d..fb791d22 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -4,7 +4,7 @@ - + diff --git a/src/Http/Controllers/StaticController.php b/src/Http/Controllers/StaticController.php index bcc97539..ca720a66 100644 --- a/src/Http/Controllers/StaticController.php +++ b/src/Http/Controllers/StaticController.php @@ -11,6 +11,9 @@ class StaticController extends Controller { + private const IGNORED_HEADER_FILES_EXTENSIONS = [ + "css", + ]; private const IGNORE_FILES = [ ".gitignore", ]; @@ -22,9 +25,8 @@ public function index(Request $request): BinaryFileResponse if (!File::exists($path) || $this->filesFilter(File::basename($path))) { abort(Response::HTTP_NOT_FOUND); } - $headers = [ - "Content-Type" => File::type($path), + "Content-Type" => in_array(File::extension($path), static::IGNORED_HEADER_FILES_EXTENSIONS, true) ? null : File::type($path), ]; return response()->file($path, $headers);