Skip to content

Commit

Permalink
fix: stricter regex for GH file URL
Browse files Browse the repository at this point in the history
URL must now include one or more "L"s in its fragment
  • Loading branch information
Kneemund committed Oct 5, 2024
1 parent e16c880 commit 28696a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bot/file_preview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mod gist;
mod github_repositoriy_file;

static GITHUB_REPOSITORY_FILE_URL_REGEX: Lazy<Regex> = Lazy::new(|| {
Regex::new(r"https://github\.com(?:/[^/\s]+){2}/(?:blob|blame)(?:/[^/\s]+)+#[^/\s]+").unwrap()
Regex::new(r"https://github\.com(?:/[^/\s]+){2}/(?:blob|blame)(?:/[^/\s]+)+#(?:[^/\s]*L[^/\s]*)+").unwrap()
});

static GIST_URL_REGEX: Lazy<Regex> =
Expand Down

0 comments on commit 28696a8

Please sign in to comment.