Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: filesaver only supports blob

thecodrr0266b2edcd52
diff --git a/apps/web/src/common/index.js b/apps/web/src/common/index.js
index 89feafe6a..a219ec9b1 100644
--- a/apps/web/src/common/index.js
+++ b/apps/web/src/common/index.js
@@ -115,7 +115,7 @@ export async function createBackup(save = true) {
if (!save) {
return { data, filename, ext };
} else {
- FileSaver.saveAs(data, `${filename}.${ext}`);
+ FileSaver.saveAs(new Blob([Buffer.from(data)]), `${filename}.${ext}`);
}
}
diff --git a/apps/web/src/components/dialogs/exportdialog.js b/apps/web/src/components/dialogs/exportdialog.js
index 0a81ff750..b9b526340 100644
--- a/apps/web/src/components/dialogs/exportdialog.js
+++ b/apps/web/src/components/dialogs/exportdialog.js
@@ -87,13 +87,18 @@ function ExportDialog(props) {
setProgress(index++);
const note = db.notes.note(noteId);
const content = await note.export(format);
+
if (!content) continue;
- files.push({ filename: note.title, content });
+ files.push({
+ filename: note.title,
+ content,
+ });
}
+
if (!files.length) return false;
if (files.length === 1) {
FileSaver.saveAs(
- files[0].content,
+ new Blob([Buffer.from(files[0].content)]),
`${files[0].filename}.${format}`
);
} else {
diff --git a/apps/web/src/components/dialogs/recovery-key-dialog.js b/apps/web/src/components/dialogs/recovery-key-dialog.js
index f7243d2f3..d8d49fe96 100644
--- a/apps/web/src/components/dialogs/recovery-key-dialog.js
+++ b/apps/web/src/components/dialogs/recovery-key-dialog.js
@@ -111,7 +111,10 @@ function RecoveryKeyDialog(props) {
mt={1}
fontSize="body"
onClick={() => {
- FileSaver.saveAs(key, `${email}-notesnook-recoverykey.txt`);
+ FileSaver.saveAs(
+ new Blob([Buffer.from(key)]),
+ `${email}-notesnook-recoverykey.txt`
+ );
}}
>
Download file