Skip to content

Build your personal knowledge base with Trilium Notes

fix path resolution bug when path is outside of hosted subtree

zadame4f57ab2fe7c
diff --git a/src/becca/becca_service.js b/src/becca/becca_service.js
index 929be22139..4337903b04 100644
--- a/src/becca/becca_service.js
+++ b/src/becca/becca_service.js
@@ -129,8 +129,9 @@ function getNoteTitleForPath(notePathArray) {
*/
function getSomePath(note, path = []) {
// first try to find note within hoisted note, otherwise take any existing note path
- return getSomePathInner(note, path, true)
- || getSomePathInner(note, path, false);
+ // each branch needs a separate copy since it's mutable
+ return getSomePathInner(note, [...path], true)
+ || getSomePathInner(note, [...path], false);
}
function getSomePathInner(note, path, respectHoisting) {
diff --git a/src/services/tree.js b/src/services/tree.js
index aa9983cbc9..4d2c04d970 100644
--- a/src/services/tree.js
+++ b/src/services/tree.js
@@ -30,7 +30,7 @@ function getNotes(noteIds) {
}
function validateParentChild(parentNoteId, childNoteId, branchId = null) {
- if (['root', 'hidden'].includes(childNoteId)) {
+ if (['root', 'hidden', 'share', 'lb_root', 'lb_availableshortcuts', 'lb_visibleshortcuts'].includes(childNoteId)) {
return { success: false, message: `Cannot change this note's location.`};
}