Fix: Always make Name and Tags queries case-insensitive

This commit is contained in:
André Duffeck
2023-06-13 14:16:38 +02:00
parent 5ebc596352
commit 80c944b311

View File

@@ -368,6 +368,7 @@ func formatQuery(q string) string {
fieldRe := regexp.MustCompile(`\w+:[^ ]+`)
if fieldRe.MatchString(cq) {
nameTagesRe := regexp.MustCompile(`\+?(Name|Tags)`) // detect "Name", "+Name, "Tags" and "+Tags"
parts := strings.Split(cq, " ")
cq = ""
@@ -376,7 +377,7 @@ func formatQuery(q string) string {
if len(fieldParts) > 1 {
key := fieldParts[0]
value := fieldParts[1]
if key == "Name" || key == "Tags" {
if nameTagesRe.MatchString(key) {
value = strings.ToLower(value) // do a lowercase query on the lowercased fields
}
cq += key + ":" + value + " "