mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-06 09:12:19 +00:00
fix: correctly escape backslash in queries (#10522)
# Which Problems Are Solved
While investigating a support ticket, it was discovered that some
queries using equals or not equals without case matching were not
correctly escaping the value to compare. If a value contained a
backslash (`\`) the row would not match.
# How the Problems Are Solved
- Fixed the escaping for backslash for `like` operations.
- Changed equals and not equals comparison without case matching to `=`
instead of `like`.
# Additional Changes
None
# Additional Context
- related to a support request
- requires backport to v.3 and v4.x
(cherry picked from commit 6c8d027e72)
This commit is contained in:
@@ -206,6 +206,7 @@ func (c Config) Type() dialect.DatabaseType {
|
||||
}
|
||||
|
||||
func EscapeLikeWildcards(value string) string {
|
||||
value = strings.ReplaceAll(value, "\\", "\\\\")
|
||||
value = strings.ReplaceAll(value, "%", "\\%")
|
||||
value = strings.ReplaceAll(value, "_", "\\_")
|
||||
return value
|
||||
|
||||
Reference in New Issue
Block a user