From 83e7847cdff157233d20a1841dd0c5092ff9b81c Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Thu, 4 Apr 2024 16:45:59 +0100 Subject: [PATCH] fix possible nil panic (#2809) --- internal/api/util/mime.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/util/mime.go b/internal/api/util/mime.go index 1e183d8e0..8dcbfc28c 100644 --- a/internal/api/util/mime.go +++ b/internal/api/util/mime.go @@ -121,7 +121,7 @@ func isUTF8ContentType(p []string) ([]string, bool) { for i, part := range p { // Only handle charset slice parts. - if part[:len(charset)] == charset { + if strings.HasPrefix(part, charset) { // Check if is UTF-8 charset. ok := (part == charsetUTF8)