Compare commits

..

No commits in common. "4559f16d86b97a074e9c68c9d92de7cc8aa91d2a" and "70e525357cc06857755f53c0b064b752b95a05fc" have entirely different histories.

2 changed files with 14 additions and 8 deletions

View File

@ -536,11 +536,7 @@ export const SignPage = () => {
setIsLoading(true) setIsLoading(true)
const arrayBuffer = await decrypt(selectedFile) const arrayBuffer = await decrypt(selectedFile)
if (!arrayBuffer) { if (!arrayBuffer) return
setIsLoading(false)
toast.error('Error decrypting file')
return
}
handleDecryptedArrayBuffer(arrayBuffer) handleDecryptedArrayBuffer(arrayBuffer)
} }
@ -775,9 +771,14 @@ export const SignPage = () => {
2 2
) )
const zip = await getZipWithFiles(meta, files) const zip = new JSZip()
zip.file('meta.json', stringifiedMeta) zip.file('meta.json', stringifiedMeta)
for (const [fileName, file] of Object.entries(files)) {
zip.file(`files/${fileName}`, await file.arrayBuffer())
}
const arrayBuffer = await zip const arrayBuffer = await zip
.generateAsync({ .generateAsync({
type: 'arraybuffer', type: 'arraybuffer',
@ -806,11 +807,16 @@ export const SignPage = () => {
const handleEncryptedExport = async () => { const handleEncryptedExport = async () => {
if (Object.entries(files).length === 0 || !meta) return if (Object.entries(files).length === 0 || !meta) return
const zip = new JSZip()
const stringifiedMeta = JSON.stringify(meta, null, 2) const stringifiedMeta = JSON.stringify(meta, null, 2)
const zip = await getZipWithFiles(meta, files)
zip.file('meta.json', stringifiedMeta) zip.file('meta.json', stringifiedMeta)
for (const [fileName, file] of Object.entries(files)) {
zip.file(`files/${fileName}`, await file.arrayBuffer())
}
const arrayBuffer = await zip const arrayBuffer = await zip
.generateAsync({ .generateAsync({
type: 'arraybuffer', type: 'arraybuffer',

View File

@ -20,7 +20,7 @@ export const getZipWithFiles = async (
for (const [fileName, file] of Object.entries(files)) { for (const [fileName, file] of Object.entries(files)) {
// Handle PDF Files, add marks // Handle PDF Files, add marks
if (file.isPdf && fileName in marksByFileNamePage) { if (file.isPdf) {
const blob = await addMarks(file, marksByFileNamePage[fileName]) const blob = await addMarks(file, marksByFileNamePage[fileName])
zip.file(`marked/${fileName}`, blob) zip.file(`marked/${fileName}`, blob)
} }