From 514d6f94ecd5264628d958d6fc73b7df458bb0a0 Mon Sep 17 00:00:00 2001 From: Ice3man543 Date: Thu, 7 Oct 2021 05:35:32 +0530 Subject: [PATCH] Added support for urlencoded variable variation --- v2/pkg/protocols/common/expressions/variables.go | 2 +- v2/pkg/protocols/common/expressions/variables_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/v2/pkg/protocols/common/expressions/variables.go b/v2/pkg/protocols/common/expressions/variables.go index 5bacaf60d..5026cef0e 100644 --- a/v2/pkg/protocols/common/expressions/variables.go +++ b/v2/pkg/protocols/common/expressions/variables.go @@ -6,7 +6,7 @@ import ( "strings" ) -var unresolvedVariablesRegex = regexp.MustCompile(`\{\{([^}]+)\}\}["'\)\}]*`) +var unresolvedVariablesRegex = regexp.MustCompile(`(?:%7[B|b]|\{){2}([^}]+)(?:%7[D|d]|\}){2}["'\)\}]*`) // ContainsUnresolvedVariables returns an error with variable names if the passed // input contains unresolved {{}} variables. diff --git a/v2/pkg/protocols/common/expressions/variables_test.go b/v2/pkg/protocols/common/expressions/variables_test.go index 55c35fffb..61d071351 100644 --- a/v2/pkg/protocols/common/expressions/variables_test.go +++ b/v2/pkg/protocols/common/expressions/variables_test.go @@ -15,6 +15,7 @@ func TestUnresolvedVariablesCheck(t *testing.T) { {"{{test}}", errors.New("unresolved variables found: test")}, {"{{test}}/{{another}}", errors.New("unresolved variables found: test,another")}, {"test", nil}, + {"%7b%7btest%7d%7d", errors.New("unresolved variables found: test")}, } for _, test := range tests { err := ContainsUnresolvedVariables(test.data)