]> BookStack Code Mirror - bookstack/blobdiff - app/Exceptions/JsonDebugException.php
Updated attachment links to have dropdown for open type
[bookstack] / app / Exceptions / JsonDebugException.php
index e8d61305e1232eb748b007d8c506e85ae39a0385..8acc19778e5dad7a0106edf7f9c4fe28659be52b 100644 (file)
@@ -19,10 +19,13 @@ class JsonDebugException extends Exception
     }
 
     /**
-     * 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(): JsonResponse
     {
-        return response()->json($this->data);
+        $cleaned = mb_convert_encoding($this->data, 'UTF-8');
+
+        return response()->json($cleaned);
     }
 }