Skip to content

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

web: do not overwrite filename & mimetype on attachment reupload

Abdullah Atta17f5bd28ba70
diff --git a/apps/web/src/components/editor/picker.ts b/apps/web/src/components/editor/picker.ts
index 5bb64ad81..94790262f 100644
--- a/apps/web/src/components/editor/picker.ts
+++ b/apps/web/src/components/editor/picker.ts
@@ -171,7 +171,7 @@ async function addAttachment(
`Please select the same file for reuploading. Expected hash ${expectedFileHash} but got ${hash}.`
);
- const exists = db.attachments?.exists(hash);
+ const exists = db.attachments?.attachment(hash);
if (!forceWrite && exists) {
forceWrite = (await FS.getUploadedFileSize(hash)) <= 0;
}
@@ -187,8 +187,8 @@ async function addAttachment(
...output,
hash,
hashType,
- filename: file.name,
- type: file.type,
+ filename: exists?.metadata.filename || file.name,
+ type: exists?.metadata.type || file.type,
key
});
}