From 4d19861a25a19395c529dbc3830fecfdf37130a1 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Wed, 4 May 2022 01:56:49 +0900 Subject: [PATCH 1/3] Fix accept header --- plume-common/src/activity_pub/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plume-common/src/activity_pub/mod.rs b/plume-common/src/activity_pub/mod.rs index 23b2b5f4..74283abd 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", ] From 45a6744d4d84da1fb6b160ea3582a2787f919d2c Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Wed, 4 May 2022 01:58:44 +0900 Subject: [PATCH 2/3] [skip ci]Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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 From 073b72c9ed74fa7ff5aebb3c9eae63e920129824 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Wed, 4 May 2022 02:01:58 +0900 Subject: [PATCH 3/3] Add more fixes --- plume-common/src/activity_pub/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plume-common/src/activity_pub/mod.rs b/plume-common/src/activity_pub/mod.rs index 74283abd..e04106ce 100644 --- a/plume-common/src/activity_pub/mod.rs +++ b/plume-common/src/activity_pub/mod.rs @@ -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()) {