From 9cb41f00e85639b5f1c565b74f942dfadd1a1cc1 Mon Sep 17 00:00:00 2001 From: wanghaolong613 Date: Thu, 23 Jul 2026 17:15:03 +0800 Subject: [PATCH] refactor: replace filterFlags with mime.ParseMediaType --- utils.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils.go b/utils.go index 2fecce46..51bd3dde 100644 --- a/utils.go +++ b/utils.go @@ -7,6 +7,7 @@ package gin import ( "encoding/xml" "math" + "mime" "net/http" "os" "path" @@ -89,12 +90,11 @@ func assert1(guard bool, text string) { } func filterFlags(content string) string { - for i, char := range content { - if char == ' ' || char == ';' { - return content[:i] - } + mediatype, _, err := mime.ParseMediaType(content) + if err != nil { + return content } - return content + return mediatype } func chooseData(custom, wildcard any) any {