diff --git a/src/routes/user.rs b/src/routes/user.rs index 019a593..0c04dd1 100644 --- a/src/routes/user.rs +++ b/src/routes/user.rs @@ -22,9 +22,14 @@ pub async fn me( config: &State, jwt: Middleware, ) -> Result, Status> { - let username = jwt.session; + let session = &jwt.session; - let user = get_user(&username, &config.upload_url, &mut db) + let username = match session.split(':').next() { + Some(username) => username, + None => return Err(Status::Unauthorized), + }; + + let user = get_user(username, &config.upload_url, &mut db) .await .map_err(|e| { error!("{}", e);