Skip to content

Commit

Permalink
fix(cli): Handle missing commit hash in the release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
sasa-tomic committed Jan 20, 2023
1 parent 84138ae commit d151a74
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions rs/cli/src/ic_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,17 @@ impl Cli {
if !f.starts_with('*') {
return f.to_string();
}
let (left, message) = f.split_once(']').unwrap();
let commit_hash = left.split_once('[').unwrap().1.to_string();

return format!(
"* [{}](https://github.com/dfinity/ic/commit/{}) {}",
commit_hash, commit_hash, message
);
match f.split_once(']') {
Some((left, message)) => {
let commit_hash = left.split_once('[').unwrap().1.to_string();

return format!(
"* [[{}](https://github.com/dfinity/ic/commit/{})] {}",
commit_hash, commit_hash, message
);
}
None => f.to_string(),
}
})
.join("\n");
Ok((
Expand Down

0 comments on commit d151a74

Please sign in to comment.