diff --git a/Cargo.lock b/Cargo.lock index f20ba17..c9e490b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3063,6 +3063,7 @@ dependencies = [ "quote", "regex", "syn 2.0.38", + "uuid", ] [[package]] diff --git a/src/routes/mod.rs b/src/routes/mod.rs index 345f4b9..36e317b 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -25,9 +25,6 @@ pub enum ServerError { #[display(fmt = "Bad Request")] BadClientData, - #[display(fmt = "Unauthorized")] - Unauthorized, - #[display(fmt = "Forbidden")] Forbidden, @@ -46,7 +43,6 @@ impl error::ResponseError for ServerError { match *self { ServerError::InternalError => StatusCode::INTERNAL_SERVER_ERROR, ServerError::BadClientData => StatusCode::BAD_REQUEST, - ServerError::Unauthorized => StatusCode::UNAUTHORIZED, ServerError::Forbidden => StatusCode::FORBIDDEN, ServerError::Conflict => StatusCode::CONFLICT, } diff --git a/src/routes/run.rs b/src/routes/run.rs index 8ce3d93..84e4c0c 100644 --- a/src/routes/run.rs +++ b/src/routes/run.rs @@ -318,9 +318,9 @@ pub async fn submit_gps_live( use tlms::grpc::chemo_client::ChemoClient; - let grpc_host = match std::env::var("CHEMO_GRPC") { + let grpc_host = match std::env::var("CHEMO_GRPC") { Ok(value) => value, - Err(e) => { + Err(_e) => { error!("NO grpc specified"); return Err(ServerError::InternalError); } @@ -453,16 +453,18 @@ pub async fn travel_file_upload( lon: point.point().x(), // ambiguous for coordinates on a map elevation: point.elevation, timestamp: match point.time { - Some(time) => match chrono::naive::NaiveDateTime::parse_from_str( - &time.format().unwrap(), - "%Y-%m-%dT%H:%M:%S.%fZ", - ) { - Ok(result) => result, - Err(e) => { - error!("cannot parse timestamp {e}"); - return Err(ServerError::BadClientData); + Some(time) => { + match chrono::naive::NaiveDateTime::parse_from_str( + &time.format().unwrap(), + "%Y-%m-%dT%H:%M:%S.%fZ", + ) { + Ok(result) => result, + Err(e) => { + error!("cannot parse timestamp {e}"); + return Err(ServerError::BadClientData); + } } - }, + } None => break, }, @@ -476,7 +478,7 @@ pub async fn travel_file_upload( } } } - }, + } Err(e) => { error!("cannot convert multipart string into gpx {:?}", e); return Err(ServerError::BadClientData);