disallow accidental undefined as a find value
This commit is contained in:
		
							parent
							
								
									cb39b6282e
								
							
						
					
					
						commit
						422be49b1a
					
				| @ -226,15 +226,15 @@ function wrap(db, dir, dbsMap) { | ||||
|       }); | ||||
|     }; | ||||
| 
 | ||||
|     DB.find = function (obj1, params) { | ||||
|       //var obj = obj1;
 | ||||
|       var obj = {}; | ||||
|       if (obj1) { | ||||
|         Object.keys(obj1).forEach(function (key) { | ||||
|           if (undefined !== obj1[key]) { | ||||
|             obj[key] = obj1[key]; | ||||
|           } | ||||
|         }); | ||||
|     DB.find = function (obj, params) { | ||||
|       var err; | ||||
|       Object.keys(obj).forEach(function (key) { | ||||
|         if (undefined === obj[key]) { | ||||
|           err = new Error("'" + key + "' was `undefined'. For security purposes you must explicitly set the value to null or ''"); | ||||
|         } | ||||
|       }); | ||||
|       if (err) { | ||||
|         return PromiseA.reject(err); | ||||
|       } | ||||
|       var sql = 'SELECT * FROM \'' + tablename + '\' '; | ||||
|       var keys = obj && Object.keys(obj); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user