mirror of
https://gitee.com/rulego/streamsql.git
synced 2026-01-11 17:25:09 +00:00
fix:修复特殊符号被认为非法
This commit is contained in:
@@ -131,7 +131,25 @@ func validateBasicSyntax(exprStr string) error {
|
||||
}
|
||||
|
||||
// Check for invalid characters
|
||||
inQuotes := false
|
||||
var quoteChar rune
|
||||
|
||||
for i, ch := range trimmed {
|
||||
// Handle quotes
|
||||
if ch == '\'' || ch == '"' {
|
||||
if !inQuotes {
|
||||
inQuotes = true
|
||||
quoteChar = ch
|
||||
} else if ch == quoteChar {
|
||||
inQuotes = false
|
||||
}
|
||||
}
|
||||
|
||||
// If inside quotes, skip character validation
|
||||
if inQuotes {
|
||||
continue
|
||||
}
|
||||
|
||||
// Allowed characters: letters, numbers, operators, parentheses, dots, underscores, spaces, quotes
|
||||
if !isValidChar(ch) {
|
||||
return fmt.Errorf("invalid character '%c' at position %d", ch, i)
|
||||
|
||||
Reference in New Issue
Block a user