X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/dabe79a438f22612e7d68c8d1de7817505b59b93..HEAD:/app/Exceptions/JsonDebugException.php diff --git a/app/Exceptions/JsonDebugException.php b/app/Exceptions/JsonDebugException.php index 6314533ce..1fa52c4a2 100644 --- a/app/Exceptions/JsonDebugException.php +++ b/app/Exceptions/JsonDebugException.php @@ -1,25 +1,32 @@ -data = $data; + parent::__construct(); } /** - * Covert this exception into a response. + * Convert this exception into a response. + * We add a manual data conversion to UTF8 to ensure any binary data is presentable as a JSON string. */ - public function render() + public function toResponse($request): JsonResponse { - return response()->json($this->data); + $cleaned = mb_convert_encoding($this->data, 'UTF-8'); + + return response()->json($cleaned); } -} \ No newline at end of file +}