mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-05-19 02:05:15 +00:00
fix(funcspec): update meta variable replacement in SQL query
This commit is contained in:
@@ -821,7 +821,7 @@ func TestReplaceMetaVariables(t *testing.T) {
|
|||||||
name: "Replace [user]",
|
name: "Replace [user]",
|
||||||
sqlQuery: "SELECT * FROM audit WHERE username = [user]",
|
sqlQuery: "SELECT * FROM audit WHERE username = [user]",
|
||||||
expectedCheck: func(result string) bool {
|
expectedCheck: func(result string) bool {
|
||||||
return strings.Contains(result, "'testuser'")
|
return strings.Contains(result, "$USR$testuser$USR$")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/bitechdev/ResolveSpec/pkg/common"
|
"github.com/bitechdev/ResolveSpec/pkg/common"
|
||||||
"github.com/bitechdev/ResolveSpec/pkg/logger"
|
"github.com/bitechdev/ResolveSpec/pkg/logger"
|
||||||
@@ -103,7 +104,7 @@ func DecodeParam(pStr string) (string, error) {
|
|||||||
code, _ = DecodeParam(code)
|
code, _ = DecodeParam(code)
|
||||||
} else {
|
} else {
|
||||||
strDat, err := base64.StdEncoding.DecodeString(code)
|
strDat, err := base64.StdEncoding.DecodeString(code)
|
||||||
if err == nil {
|
if err == nil && utf8.Valid(strDat) {
|
||||||
code = string(strDat)
|
code = string(strDat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user