templating: fix queries contained regex with braces, fixes #432

This commit is contained in:
Alexander Zobnin
2017-07-25 12:06:37 +03:00
parent b1fafc23a7
commit 996bc9e1d1
7 changed files with 152 additions and 7 deletions

View File

@@ -99,7 +99,7 @@ System.register(['lodash', 'moment'], function (_export, _context) {
* {group}{host.com} -> [group, host.com]
*/
function splitTemplateQuery(query) {
var splitPattern = /{[^{}]*}/g;
var splitPattern = /\{[^\{\}]*\}|\{\/.*\/\}/g;
var split = void 0;
if (isContainsBraces(query)) {
@@ -117,7 +117,8 @@ System.register(['lodash', 'moment'], function (_export, _context) {
_export('splitTemplateQuery', splitTemplateQuery);
function isContainsBraces(query) {
return query.includes('{') && query.includes('}');
var bracesPattern = /^\{.+\}$/;
return bracesPattern.test(query);
}
// Pattern for testing regex