Skip to content

Commit

Permalink
Remove forgotten unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
xerbalind committed Jun 19, 2024
1 parent cad46a3 commit 35ce912
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/controllers/users_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ pub async fn show_user<'r>(
pub async fn show_ssh_key<'r>(
db: DbConn,
username: String,
) -> Json<Vec<String>> {
let user = User::find_by_username(username, &db).await.unwrap();
) -> Result<Json<Vec<String>>> {
let user = User::find_by_username(username, &db).await?;
let mut keys = vec![];
if let Some(ssh_keys) = user.ssh_key {
for line in ssh_keys.lines() {
Expand All @@ -74,7 +74,7 @@ pub async fn show_ssh_key<'r>(
}
}
}
Json(keys)
Ok(Json(keys))
}

#[get("/users")]
Expand Down

0 comments on commit 35ce912

Please sign in to comment.