fixing invalid InvalidCharacterError web safe base64 encoding

This commit is contained in:
Emilien 2024-12-14 18:10:55 +01:00
parent 306f2d5f12
commit 4ca76879c1

View file

@ -22,7 +22,7 @@ export const verifyRequest = (
);
const encryptedData = new TextDecoder().decode(
decipher.decrypt(decodeBase64(stringToCheck)),
decipher.decrypt(decodeBase64(stringToCheck.replace(/-/g, "+").replace(/_/g, "/"))),
);
const [parsedTimestamp, parsedVideoId] = encryptedData.split("|");
const parsedTimestampInt = parseInt(parsedTimestamp);