summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-02-14 12:07:58 +0000
committerLibravatar tobi <tobi.smethurst@protonmail.com>2024-02-14 14:07:04 +0100
commitfb3e3ca10dc44cba841019bee1a8812e746133e9 (patch)
treeca29a71ba6a35e6a3fe1be1e1c31893d47ade120
parent[bugfix] add stricter checks during all stages of dereferencing remote AS obj... (diff)
downloadgotosocial-0.13.3.tar.xz
[chore] also allow text/xml in place of application/xml (#2640)v0.13.3
-rw-r--r--internal/api/util/mime.go5
1 files changed, 4 insertions, 1 deletions
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
}