Skip to content

Commit

Permalink
main: emit errors on auth parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
bobrippling committed Dec 15, 2024
1 parent 5ba83d3 commit 1fd7878
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ fn routes(

result_to_headers(async move {
let auth = match auth {
Some(auth) => auth.with_path_username(&username),
Some(auth) => auth.with_path_username(&username).map_err(|e| {
error!("{e}");
podsync::Error::Unauthorized
}),
None => {
error!("couldn't auth \"{username}\" - no auth header/cookie");
Err(podsync::Error::Unauthorized)
Expand Down Expand Up @@ -369,7 +372,10 @@ fn login_authorize(
let podsync = Arc::clone(&podsync);
async move {
let username = username_fmt.convert(&username)?;
let auth = auth.with_path_username(&username)?;
let auth = auth.with_path_username(&username).map_err(|e| {
error!("{e}");
podsync::Error::Unauthorized
})?;
podsync.login(auth, session_id).await
}
},
Expand Down

0 comments on commit 1fd7878

Please sign in to comment.