Skip to content

Build your personal knowledge base with Trilium Notes

fix initializing new attribute in becca

zadam37c30bf88a07
diff --git a/src/routes/api/attributes.js b/src/routes/api/attributes.js
index 9eb01ceb34..660ef2be43 100644
--- a/src/routes/api/attributes.js
+++ b/src/routes/api/attributes.js
@@ -80,9 +80,10 @@ function setNoteAttribute(req) {
attr.value = body.value;
attr.save();
} else {
- const attr = new Attribute(body);
- attr.noteId = noteId;
- attr.save();
+ const params = {...body};
+ params.noteId = noteId; // noteId must be set before calling constructor for proper initialization
+
+ new Attribute(params).save();
}
}