From 8b8211986e222109880a2bb03aaee99958ea67fb Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:07:58 +0000 Subject: [PATCH] [chore] also allow text/xml in place of application/xml (#2640) --- internal/api/util/mime.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/api/util/mime.go b/internal/api/util/mime.go index 455a84de9..1e183d8e0 100644 --- a/internal/api/util/mime.go +++ b/internal/api/util/mime.go @@ -23,6 +23,7 @@ const ( // Possible GoToSocial mimetypes. AppJSON = `application/json` AppXML = `application/xml` + appXMLText = `text/xml` // AppXML is only *recommended* in RFC7303 AppXMLXRD = `application/xrd+xml` AppRSSXML = `application/rss+xml` AppActivityJSON = `application/activity+json` @@ -58,7 +59,8 @@ func XMLContentType(ct string) bool { p := splitContentType(ct) p, ok := isUTF8ContentType(p) return ok && len(p) == 1 && - p[0] == AppXML + p[0] == AppXML || + p[0] == appXMLText } // XMLXRDContentType returns whether is application/(xrd+)?xml(;charset=utf-8)? content-type. @@ -67,6 +69,7 @@ func XMLXRDContentType(ct string) bool { p, ok := isUTF8ContentType(p) return ok && len(p) == 1 && p[0] == AppXML || + p[0] == appXMLText || p[0] == AppXMLXRD }