refactoring + added a hard path dept limit (hack?)

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-08-27 16:30:23 +03:00
parent 445c115f48
commit 65d0eb4559
2 changed files with 10 additions and 4 deletions

View File

@ -26,7 +26,7 @@ var pouchdbstore = require('./pwiki/store/pouchdb')
var store =
module.store = {
/* XXX base localstorage...
// XXX base localstorage...
__proto__: localstoragestore.localStorageStore,
__prefix__: '--pwiki-root:',
data: localStorage,

View File

@ -505,6 +505,7 @@ module.Page =
object.Constructor('Page', BasePage, {
__parser__: parser.parser,
NESTING_DEPTH_LIMIT: 20,
NESTING_RECURSION_TEST_THRESHOLD: 50,
// Filter that will isolate the page/include/.. from parent filters...
@ -732,9 +733,14 @@ object.Constructor('Page', BasePage, {
if(seen.has(full)
// nesting path recursion...
|| (full.length % (this.NESTING_RECURSION_TEST_THRESHOLD || 50) == 0
&& pwpath.split(full).length > 3
&& await page.find() == await page.get('..').find()
&& await page.find() == await page.get('../..').find())){
&& (pwpath.split(full).length > 3
&& new Set([
await page.find(),
await page.get('..').find(),
await page.get('../..').find(),
]).size == 1
// XXX HACK???
|| pwpath.split(full).length > (this.NESTING_DEPTH_LIMIT || 20)))){
if(recursive == null){
console.warn(
`@${key}(..): ${