Fix: Handle incoming labels with invalid UTF-8

It's possible that incoming labels will contain invalid UTF-8 characters. This results in a panic. This fix sanitizes the label's string to ensure only valid UTF-8 characters are included, by replacing invalid characters with � (REPLACEMENT CHARACTER)

Signed-off-by: Cooper Worobetz <cooper@worobetz.ca>
This commit is contained in:
Cooper Worobetz 2025-02-25 13:12:40 -08:00
parent 51006aba2f
commit 0df86c2384

View File

@ -159,7 +159,7 @@ func dbToString(t interface{}) (string, bool) {
// Try and convert to string
return string(v), true
case string:
return v, true
return strings.ToValidUTF8(v, "<22>"), true
case bool:
if v {
return "true", true