mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-31 02:50:08 +00:00 
			
		
		
		
	refactoring + added a hard path dept limit (hack?)
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									445c115f48
								
							
						
					
					
						commit
						65d0eb4559
					
				| @ -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, | ||||
|  | ||||
| @ -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}(..): ${ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user