From 406c0ab5a7b00063b654c62edd8adec855c29212 Mon Sep 17 00:00:00 2001 From: StarsSail <152023695+wysha-object@users.noreply.github.com> Date: Wed, 8 Jul 2026 11:35:03 +0800 Subject: [PATCH] fix: parse error (#7430) --- src/utils/uri-parser/helpers.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/utils/uri-parser/helpers.ts b/src/utils/uri-parser/helpers.ts index 509bc17df..81ad15db8 100644 --- a/src/utils/uri-parser/helpers.ts +++ b/src/utils/uri-parser/helpers.ts @@ -260,7 +260,14 @@ export function decodeBase64OrOriginal(str: string): string { const padded = padLen === 0 ? normalized : normalized + '='.repeat(4 - padLen) try { - const decoded = atob(padded) + const decodedArray = new Uint8Array( + atob(padded) + .split('') + .map((c) => c.charCodeAt(0)), + ) + const decoded = new TextDecoder('utf-8', { fatal: true }).decode( + decodedArray, + ) // Heuristic: only accept "text-like" results to avoid accidentally decoding // non-base64 strings that happen to be decodable. for (let i = 0; i < decoded.length; i++) {