Added support for urlencoded variable variation

dev
Ice3man543 2021-10-07 05:35:32 +05:30
parent 4669ee22ce
commit 514d6f94ec
2 changed files with 2 additions and 1 deletions

View File

@ -6,7 +6,7 @@ import (
"strings" "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 // ContainsUnresolvedVariables returns an error with variable names if the passed
// input contains unresolved {{<pattern-here>}} variables. // input contains unresolved {{<pattern-here>}} variables.

View File

@ -15,6 +15,7 @@ func TestUnresolvedVariablesCheck(t *testing.T) {
{"{{test}}", errors.New("unresolved variables found: test")}, {"{{test}}", errors.New("unresolved variables found: test")},
{"{{test}}/{{another}}", errors.New("unresolved variables found: test,another")}, {"{{test}}/{{another}}", errors.New("unresolved variables found: test,another")},
{"test", nil}, {"test", nil},
{"%7b%7btest%7d%7d", errors.New("unresolved variables found: test")},
} }
for _, test := range tests { for _, test := range tests {
err := ContainsUnresolvedVariables(test.data) err := ContainsUnresolvedVariables(test.data)