mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-31 02:50:08 +00:00 
			
		
		
		
	some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									65f0c6823d
								
							
						
					
					
						commit
						788d674675
					
				| @ -500,11 +500,7 @@ module.BaseStore = { | ||||
| 			return this } | ||||
| 		var exists = await this.exists(path)  | ||||
| 		path = exists | ||||
| 			// XXX SANITIZE...
 | ||||
| 			|| pwpath.sanitize(path, 'string') | ||||
| 			/*/ | ||||
| 			|| pwpath.normalize(path, 'string') | ||||
| 			//*/
 | ||||
| 		path = pwpath.splitArgs(path).path | ||||
| 		data = data instanceof Promise ? | ||||
| 			await data | ||||
| @ -654,17 +650,15 @@ module.MetaStore = { | ||||
| 	substores: undefined, | ||||
| 
 | ||||
| 	substore: function(path){ | ||||
| 		path = pwpath.normalize(path, 'string') | ||||
| 		path = pwpath.sanitize(path, 'string') | ||||
| 		if(path in (this.substores ?? {})){ | ||||
| 			return path } | ||||
| 		var root = path[0] == '/' | ||||
| 		var store = Object.keys(this.substores ?? {}) | ||||
| 			// normalize store paths to the given path...
 | ||||
| 			.filter(function(p){ | ||||
| 				p = root ? | ||||
| 					'/'+p | ||||
| 					: p | ||||
| 				return path.startsWith(p) | ||||
| 					// only keep whole path elements...
 | ||||
| 					// NOTE: this prevents matching 'a/b' with 'a/bbb', for example.
 | ||||
| 		   			&& (path[p.length] == null | ||||
| 						|| path[p.length] == '/' | ||||
| 						|| path[p.length] == '\\')}) | ||||
| @ -680,10 +674,8 @@ module.MetaStore = { | ||||
| 	isStore: function(path){ | ||||
| 		if(!this.substores){ | ||||
| 			return false } | ||||
| 		path = pwpath.normalize(path, 'string') | ||||
| 		path = path[0] == '/' ? | ||||
| 			path.slice(1) | ||||
| 			: path | ||||
| 		path = pwpath.sanitize(path, 'string') | ||||
| 		// XXX do we need this???
 | ||||
| 		return !!this.substores[path] | ||||
| 			|| !!this.substores['/'+ path] }, | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user