Skip to content

Commit

Permalink
Handle urlencode failure gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
raffomania committed Jan 14, 2025
1 parent 5b59920 commit 488b691
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ impl FromRequestParts<AppState> for AuthUser {
.path_and_query()
.map(|pq| pq.as_str())
.unwrap_or_default();
// TODO log error here, maybe return 500
let redirect_after_login =
urlencode(redirect_after_login).map_err(|_| Redirect::to("/login"))?;
let redirect_after_login = urlencode(redirect_after_login)
.map(|d| d.to_string())
.unwrap_or_default();

let redirect_to = format!("/login?previous_uri={redirect_after_login}",);
let error_redirect = Redirect::to(&redirect_to);
Expand Down

0 comments on commit 488b691

Please sign in to comment.