mirror of
https://github.com/zadam/trilium.git
synced 2025-11-09 14:55:50 +01:00
added checksum to note_attachment
This commit is contained in:
@@ -1442,17 +1442,22 @@ class BNote extends AbstractBeccaEntity {
|
||||
* @returns {BNoteAttachment}
|
||||
*/
|
||||
saveNoteAttachment(name, mime, content) {
|
||||
this.getNoteAttachments()
|
||||
let noteAttachment = this.getNoteAttachmentByName(name);
|
||||
|
||||
const noteAttachment = new BNoteAttachment({
|
||||
if (noteAttachment
|
||||
&& noteAttachment.mime === mime
|
||||
&& noteAttachment.contentCheckSum === noteAttachment.calculateCheckSum(content)) {
|
||||
|
||||
return noteAttachment; // no change
|
||||
}
|
||||
|
||||
noteAttachment = new BNoteAttachment({
|
||||
noteId: this.noteId,
|
||||
name,
|
||||
mime,
|
||||
isProtected: this.isProtected
|
||||
});
|
||||
|
||||
noteAttachment.save();
|
||||
|
||||
noteAttachment.setContent(content);
|
||||
|
||||
return noteAttachment;
|
||||
|
||||
Reference in New Issue
Block a user