From 4ca76879c17ce1b02739af23857cbd0289d42093 Mon Sep 17 00:00:00 2001 From: Emilien <4016501+unixfox@users.noreply.github.com> Date: Sat, 14 Dec 2024 18:10:55 +0100 Subject: [PATCH] fixing invalid InvalidCharacterError web safe base64 encoding --- src/lib/helpers/verifyRequest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/helpers/verifyRequest.ts b/src/lib/helpers/verifyRequest.ts index 2a0ae08..3f60e4f 100644 --- a/src/lib/helpers/verifyRequest.ts +++ b/src/lib/helpers/verifyRequest.ts @@ -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);