diff options
Diffstat (limited to 'server/src/git_root.rs')
| -rw-r--r-- | server/src/git_root.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/src/git_root.rs b/server/src/git_root.rs index ec741c4..f915095 100644 --- a/server/src/git_root.rs +++ b/server/src/git_root.rs @@ -252,10 +252,10 @@ async fn git_process_prehook( let translation_review_id; - if branch.starts_with("t/") { + if let Some(stripped_branch) = branch.strip_prefix("t/") { // Translation review - translation_review_id = branch[2..].parse::<u64>().ok(); + translation_review_id = stripped_branch.parse::<u64>().ok(); if translation_review_id.is_none() { error!("{branch}: Invalid translation review branch"); errors.push(format!("{branch}: Invalid translation review branch")); @@ -428,9 +428,9 @@ async fn git_process_posthook( let branch = row.reference.strip_prefix("refs/heads/").unwrap(); - if branch.starts_with("t/") { + if let Some(stripped_branch) = branch.strip_prefix("t/") { // pre-hook already checked format - let id = branch[2..].parse::<u64>().unwrap(); + let id = stripped_branch.parse::<u64>().unwrap(); match sqlx::query!( "UPDATE translation_reviews SET head=? WHERE project=? AND id=?", |
