Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Check multiple Accept headers for content-type (#1935)

tobide5936ae437d
diff --git a/router/middleware/activityPub.go b/router/middleware/activityPub.go
index 3c3805a0f0..51fdc09ca7 100644
--- a/router/middleware/activityPub.go
+++ b/router/middleware/activityPub.go
@@ -22,8 +22,10 @@ func RequireActivityPubOrRedirect(handler http.HandlerFunc) http.HandlerFunc {
}
acceptedContentTypes := []string{"application/json", "application/json+ld", "application/activity+json", `application/ld+json; profile="https://www.w3.org/ns/activitystreams"`}
- acceptString := r.Header.Get("Accept")
- accept := strings.Split(acceptString, ",")
+ var accept []string
+ for _, a := range r.Header.Values("Accept") {
+ accept = append(accept, strings.Split(a, ",")...)
+ }
for _, singleType := range accept {
if _, accepted := utils.FindInSlice(acceptedContentTypes, strings.TrimSpace(singleType)); accepted {