From e498ecb082ebc5c2022b225f7824a12932282d6e Mon Sep 17 00:00:00 2001 From: Davinci Date: Wed, 15 May 2024 11:57:35 +0200 Subject: [PATCH] fix: entering decryption key manually does not work because of encoded URI --- src/pages/decrypt/index.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/pages/decrypt/index.tsx b/src/pages/decrypt/index.tsx index 6b20491..a96676b 100644 --- a/src/pages/decrypt/index.tsx +++ b/src/pages/decrypt/index.tsx @@ -24,20 +24,22 @@ export const DecryptZip = () => { const fileUrl = searchParams.get('file') if (fileUrl) { + const decodedFileUrl = decodeURIComponent(fileUrl) + setIsLoading(true) setLoadingSpinnerDesc('Fetching zip file') axios - .get(fileUrl, { + .get(decodedFileUrl, { responseType: 'arraybuffer' }) .then((res) => { - const fileName = fileUrl.split('/').pop() + const fileName = decodedFileUrl.split('/').pop() const file = new File([res.data], fileName!) setSelectedFile(file) }) .catch((err) => { console.error( - `error occurred in getting zip file from ${fileUrl}`, + `error occurred in getting zip file from ${decodedFileUrl}`, err ) }) @@ -47,7 +49,10 @@ export const DecryptZip = () => { } const key = searchParams.get('key') - if (key) setEncryptionKey(key) + if (key) { + const decodedKey = decodeURIComponent(key) + setEncryptionKey(decodedKey) + } }, [searchParams]) const handleDecrypt = async () => { -- 2.34.1