Skip to content

Commit d4bc241

Browse files
authored
Merge pull request #3428 from Spinnich/fix/m3u-crc-non-ascii-filenames
fix(nginx): use Buffer for binary-safe base64 decode in m3u endpoint
2 parents 9b97e32 + e943cc7 commit d4bc241

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

docker/nginx/js/decode.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ function decodeBase64(r) {
99
}
1010

1111
try {
12-
var decodedValue = atob(encodedValue);
13-
r.return(200, decodedValue);
12+
// Use Buffer to return raw bytes — atob() returns a JS string which r.return()
13+
// would re-encode as UTF-8, corrupting any non-ASCII bytes (e.g. in filenames
14+
// like "Pokémon") and causing CRC mismatches in the mod_zip manifest.
15+
r.return(200, Buffer.from(encodedValue, 'base64'));
1416
} catch (e) {
1517
r.return(400, "Invalid Base64 encoding");
1618
}

0 commit comments

Comments
 (0)