@@ -50,7 +50,7 @@ use jmap::{
5050 websocket:: upgrade:: WebSocketUpgrade ,
5151} ;
5252use jmap_proto:: request:: { Request , capability:: Session } ;
53- use std:: { net:: IpAddr , sync:: Arc } ;
53+ use std:: { net:: IpAddr , str :: FromStr , sync:: Arc } ;
5454use store:: dispatch:: lookup:: KeyValue ;
5555use trc:: SecurityEvent ;
5656use types:: { blob:: BlobId , id:: Id } ;
@@ -93,7 +93,7 @@ impl ParseHttp for Server {
9393 let ( _in_flight, access_token) =
9494 self . authenticate_headers ( & req, & session, false ) . await ?;
9595
96- let request = fetch_body (
96+ let bytes = fetch_body (
9797 & mut req,
9898 if !access_token. has_permission ( Permission :: UnlimitedUploads ) {
9999 self . core . jmap . upload_max_size
@@ -103,17 +103,18 @@ impl ParseHttp for Server {
103103 session. session_id ,
104104 )
105105 . await
106- . ok_or_else ( || trc:: LimitEvent :: SizeRequest . into_err ( ) )
107- . and_then ( |bytes| {
108- Request :: parse (
109- & bytes,
110- self . core . jmap . request_max_calls ,
111- self . core . jmap . request_max_size ,
112- )
113- } ) ?;
106+ . ok_or_else ( || trc:: LimitEvent :: SizeRequest . into_err ( ) ) ?;
114107
115108 return Ok ( self
116- . handle_jmap_request ( request, access_token, & session)
109+ . handle_jmap_request (
110+ Request :: parse (
111+ & bytes,
112+ self . core . jmap . request_max_calls ,
113+ self . core . jmap . request_max_size ,
114+ ) ?,
115+ access_token,
116+ & session,
117+ )
117118 . await
118119 . into_http_response ( ) ) ;
119120 }
@@ -123,7 +124,7 @@ impl ParseHttp for Server {
123124 self . authenticate_headers ( & req, & session, false ) . await ?;
124125
125126 if let ( Some ( _) , Some ( blob_id) , Some ( name) ) = (
126- path. next ( ) . and_then ( |p| Id :: from_bytes ( p . as_bytes ( ) ) ) ,
127+ path. next ( ) . and_then ( |p| Id :: from_str ( p ) . ok ( ) ) ,
127128 path. next ( ) . and_then ( BlobId :: from_base32) ,
128129 path. next ( ) ,
129130 ) {
@@ -151,9 +152,7 @@ impl ParseHttp for Server {
151152 let ( _in_flight, access_token) =
152153 self . authenticate_headers ( & req, & session, false ) . await ?;
153154
154- if let Some ( account_id) =
155- path. next ( ) . and_then ( |p| Id :: from_bytes ( p. as_bytes ( ) ) )
156- {
155+ if let Some ( account_id) = path. next ( ) . and_then ( |p| Id :: from_str ( p) . ok ( ) ) {
157156 return match fetch_body (
158157 & mut req,
159158 if !access_token. has_permission ( Permission :: UnlimitedUploads ) {
0 commit comments