Skip to content

Build your personal knowledge base with Trilium Notes

defensive copies of owned attrs

zadam83049c95c376
diff --git a/db/migrations/0212__delete_all_attributes_of_named_notes.js b/db/migrations/0212__delete_all_attributes_of_named_notes.js
index d90f25e44b..a6f532231c 100644
--- a/db/migrations/0212__delete_all_attributes_of_named_notes.js
+++ b/db/migrations/0212__delete_all_attributes_of_named_notes.js
@@ -18,7 +18,7 @@ module.exports = () => {
if (noteId.startsWith("_")) { // is "named" note
const note = becca.getNote(noteId);
- for (const attr of note.getOwnedAttributes()) {
+ for (const attr of note.getOwnedAttributes().slice()) {
attr.markAsDeleted("0212__delete_all_attributes_of_named_notes");
}
}
diff --git a/src/becca/entities/abstract_becca_entity.js b/src/becca/entities/abstract_becca_entity.js
index 863d2bb6fc..bcebb5ee61 100644
--- a/src/becca/entities/abstract_becca_entity.js
+++ b/src/becca/entities/abstract_becca_entity.js
@@ -274,8 +274,6 @@ class AbstractBeccaEntity {
[this.dateModified, entityId]);
}
- console.trace("DELETE");
-
log.info(`Marking ${entityName} ${entityId} as deleted`);
this.addEntityChange(true);
@@ -293,8 +291,6 @@ class AbstractBeccaEntity {
WHERE ${this.constructor.primaryKeyName} = ?`,
[this.utcDateModified, entityId]);
- console.trace("DELETE");
-
log.info(`Marking ${entityName} ${entityId} as deleted`);
this.addEntityChange(true);
diff --git a/src/becca/entities/bbranch.js b/src/becca/entities/bbranch.js
index cbb08ff8a2..24d2cea790 100644
--- a/src/becca/entities/bbranch.js
+++ b/src/becca/entities/bbranch.js
@@ -191,7 +191,7 @@ class BBranch extends AbstractBeccaEntity {
this.becca.notes[note.noteId].isBeingDeleted = true;
- for (const attribute of note.getOwnedAttributes()) {
+ for (const attribute of note.getOwnedAttributes().slice()) {
attribute.markAsDeleted(deleteId);
}