A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: convert arraybuffer to buffer when attaching files/images
thecodrr6b8a9993c67c
diff --git a/apps/web/src/components/editor/plugins/picker.js b/apps/web/src/components/editor/plugins/picker.jsindex e3e7d4abf..85e34cd84 100644--- a/apps/web/src/components/editor/plugins/picker.js+++ b/apps/web/src/components/editor/plugins/picker.js@@ -39,7 +39,7 @@ async function pickFile() {if (!selectedFile) return;const buffer = await selectedFile.arrayBuffer();- const { hash, type: hashType } = await fs.hashBuffer(buffer);+ const { hash, type: hashType } = await fs.hashBuffer(Buffer.from(buffer));const output = db.attachments.exists(hash)? {}@@ -73,7 +73,7 @@ async function pickImage() {if (!selectedImage) return;const { dataurl, buffer } = await compressImage(selectedImage, "buffer");- const { hash, type: hashType } = await fs.hashBuffer(buffer);+ const { hash, type: hashType } = await fs.hashBuffer(Buffer.from(buffer));const output = db.attachments.exists(hash)? {}@@ -130,6 +130,7 @@ function showFilePicker({ acceptedFileTypes }) {** @param {File} file* @param {"base64"|"buffer"} type+ * @returns {{ dataurl: string, buffer: ArrayBuffer }}*/function compressImage(file, type) {return new Promise((resolve, reject) => {