diff --git a/lib/cartodb/template_maps.js b/lib/cartodb/template_maps.js index c809b63f..d026fa7e 100644 --- a/lib/cartodb/template_maps.js +++ b/lib/cartodb/template_maps.js @@ -88,7 +88,8 @@ o._redisCmd = function(redisFunc, redisArgs, callback) { ); }; -var _reValidIdentifier = /^[a-z0-9][0-9a-z_\-]*$/i; +var _reValidNameIdentifier = /^[a-z0-9][0-9a-z_\-]*$/i; +var _reValidPlaceholderIdentifier = /^[a-z][0-9a-z_]*$/i; // jshint maxcomplexity:15 o._checkInvalidTemplate = function(template) { if ( template.version != '0.0.1' ) { @@ -98,7 +99,7 @@ o._checkInvalidTemplate = function(template) { if ( ! tplname ) { return new Error("Missing template name"); } - if ( ! tplname.match(_reValidIdentifier) ) { + if ( ! tplname.match(_reValidNameIdentifier) ) { return new Error("Invalid characters in template name '" + tplname + "'"); } @@ -113,7 +114,7 @@ o._checkInvalidTemplate = function(template) { for (var i = 0, len = placeholderKeys.length; i < len; i++) { var placeholderKey = placeholderKeys[i]; - if (!placeholderKey.match(_reValidIdentifier)) { + if (!placeholderKey.match(_reValidPlaceholderIdentifier)) { return new Error("Invalid characters in placeholder name '" + placeholderKey + "'"); } if ( ! placeholders[placeholderKey].hasOwnProperty('default') ) {