fix: entering decryption key manually does not work because of encoded URI
This commit is contained in:
parent
8be01d96dd
commit
b2d7461128
@ -24,20 +24,22 @@ export const DecryptZip = () => {
|
|||||||
const fileUrl = searchParams.get('file')
|
const fileUrl = searchParams.get('file')
|
||||||
|
|
||||||
if (fileUrl) {
|
if (fileUrl) {
|
||||||
|
const decodedFileUrl = decodeURIComponent(fileUrl)
|
||||||
|
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
setLoadingSpinnerDesc('Fetching zip file')
|
setLoadingSpinnerDesc('Fetching zip file')
|
||||||
axios
|
axios
|
||||||
.get(fileUrl, {
|
.get(decodedFileUrl, {
|
||||||
responseType: 'arraybuffer'
|
responseType: 'arraybuffer'
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const fileName = fileUrl.split('/').pop()
|
const fileName = decodedFileUrl.split('/').pop()
|
||||||
const file = new File([res.data], fileName!)
|
const file = new File([res.data], fileName!)
|
||||||
setSelectedFile(file)
|
setSelectedFile(file)
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(
|
console.error(
|
||||||
`error occurred in getting zip file from ${fileUrl}`,
|
`error occurred in getting zip file from ${decodedFileUrl}`,
|
||||||
err
|
err
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -47,7 +49,10 @@ export const DecryptZip = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const key = searchParams.get('key')
|
const key = searchParams.get('key')
|
||||||
if (key) setEncryptionKey(key)
|
if (key) {
|
||||||
|
const decodedKey = decodeURIComponent(key)
|
||||||
|
setEncryptionKey(decodedKey)
|
||||||
|
}
|
||||||
}, [searchParams])
|
}, [searchParams])
|
||||||
|
|
||||||
const handleDecrypt = async () => {
|
const handleDecrypt = async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user