Skip to content

Commit 740cc5b

Browse files
committed
fix(ui): localize expired pairing QR notice
1 parent d39ac85 commit 740cc5b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎ui/src/ui/chat/grouped-render.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,16 +1702,19 @@ const MAX_JSON_AUTOPARSE_CHARS = 20_000;
17021702
* Size-capped to prevent render-loop DoS from large JSON messages.
17031703
*/
17041704
function detectJson(text: string): { parsed: unknown; pretty: string } | null {
1705-
const t = text.trim();
1705+
const trimmed = text.trim();
17061706

17071707
// Enforce size cap to prevent UI freeze from multi-MB JSON payloads
1708-
if (t.length > MAX_JSON_AUTOPARSE_CHARS) {
1708+
if (trimmed.length > MAX_JSON_AUTOPARSE_CHARS) {
17091709
return null;
17101710
}
17111711

1712-
if ((t.startsWith("{") && t.endsWith("}")) || (t.startsWith("[") && t.endsWith("]"))) {
1712+
if (
1713+
(trimmed.startsWith("{") && trimmed.endsWith("}")) ||
1714+
(trimmed.startsWith("[") && trimmed.endsWith("]"))
1715+
) {
17131716
try {
1714-
const parsed = JSON.parse(t);
1717+
const parsed = JSON.parse(trimmed);
17151718
return { parsed, pretty: JSON.stringify(parsed, null, 2) };
17161719
} catch {
17171720
return null;

0 commit comments

Comments
 (0)