mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-30 18:40: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 =  | var store =  | ||||||
| module.store = {  | module.store = {  | ||||||
| 	/* XXX base localstorage... | 	// XXX base localstorage...
 | ||||||
| 	__proto__: localstoragestore.localStorageStore, | 	__proto__: localstoragestore.localStorageStore, | ||||||
| 	__prefix__: '--pwiki-root:', | 	__prefix__: '--pwiki-root:', | ||||||
| 	data: localStorage, | 	data: localStorage, | ||||||
|  | |||||||
| @ -505,6 +505,7 @@ module.Page = | |||||||
| object.Constructor('Page', BasePage, { | object.Constructor('Page', BasePage, { | ||||||
| 	__parser__: parser.parser, | 	__parser__: parser.parser, | ||||||
| 
 | 
 | ||||||
|  | 	NESTING_DEPTH_LIMIT: 20, | ||||||
| 	NESTING_RECURSION_TEST_THRESHOLD: 50, | 	NESTING_RECURSION_TEST_THRESHOLD: 50, | ||||||
| 
 | 
 | ||||||
| 	// Filter that will isolate the page/include/.. from parent filters...
 | 	// Filter that will isolate the page/include/.. from parent filters...
 | ||||||
| @ -732,9 +733,14 @@ object.Constructor('Page', BasePage, { | |||||||
| 					if(seen.has(full) | 					if(seen.has(full) | ||||||
| 							// nesting path recursion...
 | 							// nesting path recursion...
 | ||||||
| 							|| (full.length % (this.NESTING_RECURSION_TEST_THRESHOLD || 50) == 0 | 							|| (full.length % (this.NESTING_RECURSION_TEST_THRESHOLD || 50) == 0 | ||||||
| 								&& pwpath.split(full).length > 3 | 								&& (pwpath.split(full).length > 3 | ||||||
| 								&& await page.find() == await page.get('..').find() | 									&& new Set([ | ||||||
| 								&& await page.find() == await page.get('../..').find())){ | 											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){ | 						if(recursive == null){ | ||||||
| 							console.warn( | 							console.warn( | ||||||
| 								`@${key}(..): ${ | 								`@${key}(..): ${ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user