Add more fixes

This commit is contained in:
Kitaiti Makoto 2022-05-04 02:01:58 +09:00
parent 45a6744d4d
commit 073b72c9ed
1 changed files with 5 additions and 3 deletions

View File

@ -87,14 +87,16 @@ impl<'a, 'r> FromRequest<'a, 'r> for ApRequest {
.map(|header| { .map(|header| {
header header
.split(',') .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 // 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://www.w3.org/ns/activitystreams\""
| "application/ld+json;profile=\"https://w3.org/ns/activitystreams\"" | "application/ld+json;profile=\"https://www.w3.org/ns/activitystreams\""
| "application/activity+json" | "application/activity+json"
| "application/ld+json" => Outcome::Success(ApRequest), | "application/ld+json" => Outcome::Success(ApRequest),
"text/html" => Outcome::Forward(true), "text/html" => Outcome::Forward(true),
_ => Outcome::Forward(false), _ => Outcome::Forward(false),
}
}) })
.fold(Outcome::Forward(false), |out, ct| { .fold(Outcome::Forward(false), |out, ct| {
if out.clone().forwarded().unwrap_or_else(|| out.is_success()) { if out.clone().forwarded().unwrap_or_else(|| out.is_success()) {