mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-22 08:13:42 +01:00
[chore] also allow text/xml in place of application/xml (#2640)
This commit is contained in:
parent
b9013a8ab3
commit
fb3e3ca10d
@ -23,6 +23,7 @@
|
|||||||
// Possible GoToSocial mimetypes.
|
// Possible GoToSocial mimetypes.
|
||||||
AppJSON = `application/json`
|
AppJSON = `application/json`
|
||||||
AppXML = `application/xml`
|
AppXML = `application/xml`
|
||||||
|
appXMLText = `text/xml` // AppXML is only *recommended* in RFC7303
|
||||||
AppXMLXRD = `application/xrd+xml`
|
AppXMLXRD = `application/xrd+xml`
|
||||||
AppRSSXML = `application/rss+xml`
|
AppRSSXML = `application/rss+xml`
|
||||||
AppActivityJSON = `application/activity+json`
|
AppActivityJSON = `application/activity+json`
|
||||||
@ -58,7 +59,8 @@ func XMLContentType(ct string) bool {
|
|||||||
p := splitContentType(ct)
|
p := splitContentType(ct)
|
||||||
p, ok := isUTF8ContentType(p)
|
p, ok := isUTF8ContentType(p)
|
||||||
return ok && len(p) == 1 &&
|
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.
|
// 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)
|
p, ok := isUTF8ContentType(p)
|
||||||
return ok && len(p) == 1 &&
|
return ok && len(p) == 1 &&
|
||||||
p[0] == AppXML ||
|
p[0] == AppXML ||
|
||||||
|
p[0] == appXMLText ||
|
||||||
p[0] == AppXMLXRD
|
p[0] == AppXMLXRD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user