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
web: ensure file exists & is of the right size after encryption
Abdullah Attae59b4320076d
diff --git a/apps/web/src/interfaces/fs.ts b/apps/web/src/interfaces/fs.tsindex 889825ca3..046583c07 100644--- a/apps/web/src/interfaces/fs.ts+++ b/apps/web/src/interfaces/fs.ts@@ -110,6 +110,11 @@ export async function writeEncryptedFile().pipeTo(fileHandle.writeable);+ if (!(await exists(fileHandle))) {+ await fileHandle.delete();+ throw new Error("Failed to encrypt file. Please try again.");+ }+AppEventManager.publish(AppEvents.fileEncrypted, {hash,total: 1,@@ -624,6 +629,11 @@ export async function streamingDecryptFile(if (!fileMetadata) return false;const fileHandle = await streamablefs.readFile(filename);+ logger.info("decrypting file", {+ filename,+ size: fileHandle?.file.size,+ actualSize: await fileHandle?.size()+ });if (!fileHandle) return false;const { key, iv } = fileMetadata;