diff --git a/CHANGELOG.md b/CHANGELOG.md index 18552e09..de314b9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Add explanation of sign-up step at sign-up page when email sign-up mode (#1012) - Add NOT NULL constraint to email_blocklist table fields (#1016) - Don't fill empty content when switching rich editor (#1017) +- Fix accept header (#1058) ## [[0.7.1]] - 2022-01-12 diff --git a/plume-common/src/activity_pub/mod.rs b/plume-common/src/activity_pub/mod.rs index 23b2b5f4..e04106ce 100644 --- a/plume-common/src/activity_pub/mod.rs +++ b/plume-common/src/activity_pub/mod.rs @@ -24,8 +24,8 @@ pub const AP_CONTENT_TYPE: &str = pub fn ap_accept_header() -> Vec<&'static str> { vec![ - "application/ld+json; profile=\"https://w3.org/ns/activitystreams\"", - "application/ld+json;profile=\"https://w3.org/ns/activitystreams\"", + "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", + "application/ld+json;profile=\"https://www.w3.org/ns/activitystreams\"", "application/activity+json", "application/ld+json", ] @@ -87,14 +87,16 @@ impl<'a, 'r> FromRequest<'a, 'r> for ApRequest { .map(|header| { header .split(',') - .map(|ct| match ct.trim() { + .map(|ct| { + match ct.trim() { // bool for Forward: true if found a valid Content-Type for Plume first (HTML), false otherwise - "application/ld+json; profile=\"https://w3.org/ns/activitystreams\"" - | "application/ld+json;profile=\"https://w3.org/ns/activitystreams\"" + "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"" + | "application/ld+json;profile=\"https://www.w3.org/ns/activitystreams\"" | "application/activity+json" | "application/ld+json" => Outcome::Success(ApRequest), "text/html" => Outcome::Forward(true), _ => Outcome::Forward(false), + } }) .fold(Outcome::Forward(false), |out, ct| { if out.clone().forwarded().unwrap_or_else(|| out.is_success()) {