[backend/federation] Allow JSON-LD profile to be specified in a space delimited string

Ref: https://www.w3.org/TR/json-ld11/#example-168-http-request-with-profile-requesting-a-compacted-document-with-a-reference-to-a-compaction-context
This commit is contained in:
Laura Hausmann 2024-02-17 16:42:08 +01:00
parent 2b141f8084
commit 7d55cbe25a
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -57,10 +57,11 @@ public class ActivityFetcherService(HttpClient client, HttpRequestService httpRq
headersContentType switch headersContentType switch
{ {
{ MediaType: "application/activity+json" } => true, { MediaType: "application/activity+json" } => true,
{ MediaType: "application/ld+json" } when headersContentType.Parameters.Any(p => p is { MediaType: "application/ld+json" } when headersContentType.Parameters.Any(p =>
{ p.Value != null &&
Name: "profile", Value: "https://www.w3.org/ns/activitystreams" p.Name.ToLowerInvariant() == "profile" &&
}) => true, p.Value.Split(" ").Contains("https://www.w3.org/ns/activitystreams"))
=> true,
_ => false _ => false
}; };