mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Property expressions must not be blank
This commit is contained in:
		| @@ -284,6 +284,9 @@ RED.utils = (function() { | ||||
|         // in red/runtime/util.js | ||||
|  | ||||
|         var length = str.length; | ||||
|         if (length === 0) { | ||||
|             return false; | ||||
|         } | ||||
|         var start = 0; | ||||
|         var inString = false; | ||||
|         var inBox = false; | ||||
|   | ||||
| @@ -133,6 +133,9 @@ function normalisePropertyExpression(str) { | ||||
|     // in editor/js/ui/utils.js | ||||
|  | ||||
|     var length = str.length; | ||||
|     if (length === 0) { | ||||
|         throw new Error("Invalid property expression: zero-length"); | ||||
|     } | ||||
|     var parts = []; | ||||
|     var start = 0; | ||||
|     var inString = false; | ||||
|   | ||||
| @@ -361,6 +361,7 @@ describe("red/util", function() { | ||||
|         it("fail a[0].[1]",function() { testInvalid("a[0].[1]"); }) | ||||
|         it("fail a['']",function() { testInvalid("a['']"); }) | ||||
|         it("fail 'a.b'c",function() { testInvalid("'a.b'c"); }) | ||||
|         it("fail <blank>",function() { testInvalid("");}) | ||||
|  | ||||
|     }); | ||||
| }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user