]>
BookStack Code Mirror - bookstack/blobdiff - app/Exceptions/JsonDebugException.php
projects
/
bookstack
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Copying: Fixed issue with non-page links to page permalinks
[bookstack]
/
app
/
Exceptions
/
JsonDebugException.php
diff --git
a/app/Exceptions/JsonDebugException.php
b/app/Exceptions/JsonDebugException.php
index e037fcb8e9041dd7bcb4f8115af350b299cb148d..1fa52c4a2abf914486690cbc674b83a284258d65 100644
(file)
--- a/
app/Exceptions/JsonDebugException.php
+++ b/
app/Exceptions/JsonDebugException.php
@@
-3,24
+3,30
@@
namespace BookStack\Exceptions;
use Exception;
namespace BookStack\Exceptions;
use Exception;
+use Illuminate\Http\JsonResponse;
+use Illuminate\Contracts\Support\Responsable;
-class JsonDebugException extends Exception
+class JsonDebugException extends Exception
implements Responsable
{
{
- protected $data;
+ protected
array
$data;
/**
* JsonDebugException constructor.
*/
/**
* JsonDebugException constructor.
*/
- public function __construct($data)
+ public function __construct(
array
$data)
{
$this->data = $data;
{
$this->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);
}
}
}
}