Skip to content

Commit

Permalink
fix(download): fix github regex pattern and make filter case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
QaidVoid committed Nov 13, 2024
1 parent 0a8d1bd commit 546cb62
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/misc/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct GithubRelease {
}

static GITHUB_URL_REGEX: &str =
r"^(?i)(?:https?://)?(?:github(?:\.com)?[:/])([^/@]+/[^/@]+)(?:@([^/\s]+))?(?:/.*)?$";
r"^(?i)(?:https?://)?(?:github(?:\.com)?[:/])([^/@]+/[^/@]+)(?:@([^/\s]+))?$";

fn extract_filename(url: &str) -> String {
Path::new(url)
Expand Down Expand Up @@ -259,10 +259,14 @@ pub async fn download_and_save(
.iter()
.all(|regex| regex.is_match(&asset.name))
&& match_keywords.map_or(true, |keywords| {
keywords.iter().all(|keyword| asset.name.contains(keyword))
keywords.iter().all(|keyword| {
asset.name.to_lowercase().contains(&keyword.to_lowercase())
})
})
&& exclude_keywords.map_or(true, |keywords| {
keywords.iter().all(|keyword| !asset.name.contains(keyword))
keywords.iter().all(|keyword| {
!asset.name.to_lowercase().contains(&keyword.to_lowercase())
})
})
})
.collect();
Expand Down

0 comments on commit 546cb62

Please sign in to comment.