summaryrefslogtreecommitdiff
path: root/internal/api/util
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-02-14 12:07:58 +0000
committerLibravatar GitHub <noreply@github.com>2024-02-14 13:07:58 +0100
commit8b8211986e222109880a2bb03aaee99958ea67fb (patch)
treeb030e90a0317de30ebf9d5cd54f8db6864773873 /internal/api/util
parent[bugfix] add stricter checks during all stages of dereferencing remote AS obj... (diff)
downloadgotosocial-8b8211986e222109880a2bb03aaee99958ea67fb.tar.xz
[chore] also allow text/xml in place of application/xml (#2640)
Diffstat (limited to 'internal/api/util')
-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
}