Skip to content

Commit

Permalink
Fix url validation regex (#193)
Browse files Browse the repository at this point in the history
Fix a bug where toplevel domains containing a "-" would falsely be
flagged as invalid
  • Loading branch information
Jasper-Ben authored Sep 4, 2022
1 parent b1d31f8 commit d3b91b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config/issuetracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ var validIssueTrackers = []IssueTracker{
}

var originPatterns = map[IssueTracker]*regexp.Regexp{
IssueTrackerJira: regexp.MustCompile(`^(https?://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9]+)+(:[0-9]+)?$`),
IssueTrackerJira: regexp.MustCompile(`^(https?://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?$`),
IssueTrackerGithub: regexp.MustCompile(`^(https?://)?(www\.)?github\.com/[\w-]+/[\w-]+`),
IssueTrackerGitlab: regexp.MustCompile(`^(https?://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9]+)+(:[0-9]+)?/[\w-]+/[\w-]+$`),
IssueTrackerGitlab: regexp.MustCompile(`^(https?://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?/[\w-]+/[\w-]+$`),
IssueTrackerPivotal: regexp.MustCompile(`^(https?://)?(www\.)?pivotaltracker\.com/n/projects/[0-9]+`),
IssueTrackerRedmine: regexp.MustCompile(`^(https?://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9]+)+(:[0-9]+)?$`),
IssueTrackerRedmine: regexp.MustCompile(`^(https?://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?$`),
IssueTrackerYoutrack: regexp.MustCompile(`^(https?://)?(www\.)?[0-9A-z-]{2,}\/?.*$`),
IssueTrackerAzure: regexp.MustCompile(`^(https?://)?(www\.)?dev\.azure\.com/([a-zA-Z0-9]+)+\/([a-zA-Z0-9]+)+.*$`),
}
Expand Down

0 comments on commit d3b91b6

Please sign in to comment.