Merge pull request 'Fixes #1051 Fix accept header' (#1058) from activitystreams-content-type into main
Reviewed-on: https://git.joinplu.me/Plume/Plume/pulls/1058
This commit is contained in:
		
						commit
						ef57ef91f0
					
				| @ -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 | ||||
| 
 | ||||
|  | ||||
| @ -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()) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user