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

@@ -120,7 +120,7 @@ function escapeMacro(macro) {
* {group}{host.com} -> [group, host.com]
*/
function splitTemplateQuery(query) {
var splitPattern = /{[^{}]*}/g;
var splitPattern = /\{[^\{\}]*\}|\{\/.*\/\}/g;
var split = void 0;
if (isContainsBraces(query)) {
@@ -136,7 +136,8 @@ function splitTemplateQuery(query) {
}
function isContainsBraces(query) {
return query.includes('{') && query.includes('}');
var bracesPattern = /^\{.+\}$/;
return bracesPattern.test(query);
}
// Pattern for testing regex