Skip to content

Commit

Permalink
Avoid incorrect triple match for substrings
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh authored and indygreg committed Apr 16, 2024
1 parent d09ff92 commit 7071802
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()

let name = zf.name().to_string();

if let Some((triple, release)) = RELEASE_TRIPLES.iter().find_map(|(triple, release)| {
// Iterate over `RELEASE_TRIPLES` in reverse-order to ensure that if any triple is a
// substring of another, the longest match is used.
if let Some((triple, release)) = RELEASE_TRIPLES.iter().rev().find_map(|(triple, release)| {
if name.contains(triple) {
Some((triple, release))
} else {
Expand Down

0 comments on commit 7071802

Please sign in to comment.