Skip to content

Commit

Permalink
fix(backend): validate PAT name
Browse files Browse the repository at this point in the history
Uses the macros provided by validator to validate the name. The name already had a macro, but .validate was not called.

Resolves modrinth#1549
  • Loading branch information
Erb3 committed Nov 4, 2024
1 parent e81e056 commit a2e2927
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/labrinth/src/routes/internal/pats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ pub async fn edit_pat(
redis: Data<RedisPool>,
session_queue: Data<AuthQueue>,
) -> Result<HttpResponse, ApiError> {
info.0.validate().map_err(|err| {
ApiError::InvalidInput(validation_errors_to_string(err, None))
})?;

let user = get_user_from_headers(
&req,
&**pool,
Expand Down

0 comments on commit a2e2927

Please sign in to comment.