Skip to content

Commit

Permalink
[chore] also allow text/xml in place of application/xml (#2640)
Browse files Browse the repository at this point in the history
  • Loading branch information
NyaaaWhatsUpDoc authored and tsmethurst committed Feb 14, 2024
1 parent b9013a8 commit fb3e3ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/api/util/mime.go
Expand Up @@ -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`
Expand Down Expand Up @@ -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.
Expand All @@ -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
}

Expand Down

0 comments on commit fb3e3ca

Please sign in to comment.