mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-22 12:22:07 +08:00
fix: parse error (#7430)
This commit is contained in:
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user