You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
All: Fixes #3334: Prevent notebook to be the parent of itself
This commit is contained in:
@ -125,6 +125,11 @@ class Folder extends BaseItem {
|
||||
const folder = foldersById[parentId];
|
||||
if (!folder) break; // https://github.com/laurent22/joplin/issues/2079
|
||||
folder.note_count = (folder.note_count || 0) + noteCount.note_count;
|
||||
|
||||
// Should not happen anymore but just to be safe, add the check below
|
||||
// https://github.com/laurent22/joplin/issues/3334
|
||||
if (folder.id === folder.parent_id) break;
|
||||
|
||||
parentId = folder.parent_id;
|
||||
} while (parentId);
|
||||
});
|
||||
@ -403,6 +408,10 @@ class Folder extends BaseItem {
|
||||
if (!('duplicateCheck' in options)) options.duplicateCheck = true;
|
||||
if (!('reservedTitleCheck' in options)) options.reservedTitleCheck = true;
|
||||
if (!('stripLeftSlashes' in options)) options.stripLeftSlashes = true;
|
||||
|
||||
if (o.id && o.parent_id && o.id === o.parent_id) {
|
||||
throw new Error('Parent ID cannot be the same as ID');
|
||||
}
|
||||
}
|
||||
|
||||
if (options.stripLeftSlashes === true && o.title) {
|
||||
|
Reference in New Issue
Block a user