fix: hanlde error in decryption of zip file
This commit is contained in:
parent
349e26b628
commit
660efb3b67
@ -5,6 +5,7 @@ import { useState } from 'react'
|
||||
import { LoadingSpinner } from '../../components/LoadingSpinner'
|
||||
import { decryptArrayBuffer } from '../../utils'
|
||||
import styles from './style.module.scss'
|
||||
import { toast } from 'react-toastify'
|
||||
|
||||
export const DecryptZip = () => {
|
||||
const [selectedFile, setSelectedFile] = useState<File | null>(null)
|
||||
@ -25,7 +26,14 @@ export const DecryptZip = () => {
|
||||
const arrayBuffer = await decryptArrayBuffer(
|
||||
encryptedArrayBuffer,
|
||||
encryptionKey
|
||||
)
|
||||
).catch((err) => {
|
||||
console.log('err in decryption:>> ', err)
|
||||
toast.error(err.message || 'An error occurred while decrypting file.')
|
||||
setIsLoading(false)
|
||||
return null
|
||||
})
|
||||
|
||||
if (!arrayBuffer) return
|
||||
|
||||
const blob = new Blob([arrayBuffer])
|
||||
saveAs(blob, 'decrypted.zip')
|
||||
|
Loading…
Reference in New Issue
Block a user