fix(funcspec): update meta variable replacement in SQL query

This commit is contained in:
Hein
2026-05-18 12:13:06 +02:00
parent cd65946191
commit 6d4945a566
2 changed files with 3 additions and 2 deletions

View File

@@ -821,7 +821,7 @@ func TestReplaceMetaVariables(t *testing.T) {
name: "Replace [user]",
sqlQuery: "SELECT * FROM audit WHERE username = [user]",
expectedCheck: func(result string) bool {
return strings.Contains(result, "'testuser'")
return strings.Contains(result, "$USR$testuser$USR$")
},
},
{

View File

@@ -8,6 +8,7 @@ import (
"regexp"
"strconv"
"strings"
"unicode/utf8"
"github.com/bitechdev/ResolveSpec/pkg/common"
"github.com/bitechdev/ResolveSpec/pkg/logger"
@@ -103,7 +104,7 @@ func DecodeParam(pStr string) (string, error) {
code, _ = DecodeParam(code)
} else {
strDat, err := base64.StdEncoding.DecodeString(code)
if err == nil {
if err == nil && utf8.Valid(strDat) {
code = string(strDat)
}
}