X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/58fa7679bccafd00f9a50bcd4a87e96876331b03..refs/pull/2890/head:/app/Http/Controllers/Controller.php diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 47b03b28d..283a01cfb 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -4,7 +4,6 @@ namespace BookStack\Http\Controllers; use BookStack\Facades\Activity; use BookStack\Interfaces\Loggable; -use BookStack\HasCreatorAndUpdater; use BookStack\Model; use finfo; use Illuminate\Foundation\Bus\DispatchesJobs; @@ -16,7 +15,8 @@ use Illuminate\Routing\Controller as BaseController; abstract class Controller extends BaseController { - use DispatchesJobs, ValidatesRequests; + use DispatchesJobs; + use ValidatesRequests; /** * Check if the current user is signed in. @@ -106,7 +106,7 @@ abstract class Controller extends BaseController /** * Send back a json error message. */ - protected function jsonError(string $messageText = "", int $statusCode = 500): JsonResponse + protected function jsonError(string $messageText = '', int $statusCode = 500): JsonResponse { return response()->json(['message' => $messageText, 'status' => 'error'], $statusCode); } @@ -118,7 +118,7 @@ abstract class Controller extends BaseController { return response()->make($content, 200, [ 'Content-Type' => 'application/octet-stream', - 'Content-Disposition' => 'attachment; filename="' . $fileName . '"' + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', ]); } @@ -130,9 +130,10 @@ abstract class Controller extends BaseController { $finfo = new finfo(FILEINFO_MIME_TYPE); $mime = $finfo->buffer($content) ?: 'application/octet-stream'; + return response()->make($content, 200, [ 'Content-Type' => $mime, - 'Content-Disposition' => 'inline; filename="' . $fileName . '"' + 'Content-Disposition' => 'inline; filename="' . $fileName . '"', ]); } @@ -162,6 +163,7 @@ abstract class Controller extends BaseController /** * Log an activity in the system. + * * @param string|Loggable */ protected function logActivity(string $type, $detail = ''): void