We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b286827 commit 94cebe2Copy full SHA for 94cebe2
src/types/models/developer.rs
@@ -357,12 +357,17 @@ impl Developer {
357
display_name: &str,
358
pool: &mut PgConnection,
359
) -> Result<(), ApiError> {
360
- let str = String::from(display_name);
+ let str = String::from(display_name.trim());
361
if !str.chars().all(char::is_alphanumeric) {
362
return Err(ApiError::BadRequest(
363
"Display name must contain only alphanumeric characters".to_string(),
364
));
365
}
366
+ if str.len() < 2 {
367
+ return Err(ApiError::BadRequest(
368
+ "Display name must have > 1 character".to_string(),
369
+ ));
370
+ }
371
372
let result = match sqlx::query!(
373
"UPDATE developers SET display_name = $1 WHERE id = $2",
0 commit comments