fix: bad except in ruma wrapper
This commit is contained in:
		
							parent
							
								
									90cd11d850
								
							
						
					
					
						commit
						c1b2b468b8
					
				
					 1 changed files with 14 additions and 10 deletions
				
			
		|  | @ -59,7 +59,7 @@ where | ||||||
|         let token = request |         let token = request | ||||||
|             .headers() |             .headers() | ||||||
|             .get_one("Authorization") |             .get_one("Authorization") | ||||||
|             .map(|s| s[7..].to_owned()) // Split off "Bearer "
 |             .and_then(|s| s.get(7..)) // Split off "Bearer "
 | ||||||
|             .or_else(|| request.query_value("access_token").and_then(|r| r.ok())); |             .or_else(|| request.query_value("access_token").and_then(|r| r.ok())); | ||||||
| 
 | 
 | ||||||
|         let limit = db.globals.max_request_size(); |         let limit = db.globals.max_request_size(); | ||||||
|  | @ -134,16 +134,20 @@ where | ||||||
|                 } |                 } | ||||||
|                 AuthScheme::ServerSignatures => { |                 AuthScheme::ServerSignatures => { | ||||||
|                     // Get origin from header
 |                     // Get origin from header
 | ||||||
|                     let x_matrix = match request.headers().get_one("Authorization").map(|s| { |                     let x_matrix = match request | ||||||
|  |                         .headers() | ||||||
|  |                         .get_one("Authorization") | ||||||
|  |                         .and_then(|s| | ||||||
|                         // Split off "X-Matrix " and parse the rest
 |                         // Split off "X-Matrix " and parse the rest
 | ||||||
|                         s[9..] |                         s.get(9..)) | ||||||
|                             .split_terminator(',') |                         .map(|s| { | ||||||
|                             .map(|field| { |                             s.split_terminator(',') | ||||||
|                                 let mut splits = field.splitn(2, '='); |                                 .map(|field| { | ||||||
|                                 (splits.next(), splits.next().map(|s| s.trim_matches('"'))) |                                     let mut splits = field.splitn(2, '='); | ||||||
|                             }) |                                     (splits.next(), splits.next().map(|s| s.trim_matches('"'))) | ||||||
|                             .collect::<BTreeMap<_, _>>() |                                 }) | ||||||
|                     }) { |                                 .collect::<BTreeMap<_, _>>() | ||||||
|  |                         }) { | ||||||
|                         Some(t) => t, |                         Some(t) => t, | ||||||
|                         None => { |                         None => { | ||||||
|                             warn!("No Authorization header"); |                             warn!("No Authorization header"); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue