Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Relax the GitHub pane URL regex.
Browse files Browse the repository at this point in the history
Fix the GitHub pane URL regex that was causing #1376.

Although the actual regex for validating GitHub usernames and repository names are more complex than this, we're not actually _validating_ them, we just want to be able to parse them. The new regex, `[\w_.-]+` should encompass all valid usernames and repo names I think.

Fixes #1376
  • Loading branch information
grokys committed Dec 12, 2017
1 parent ba29d80 commit f55c19e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/GitHub.App/ViewModels/GitHubPane/GitHubPaneViewModel.cs
Expand Up @@ -402,8 +402,8 @@ static async Task<bool> IsValidRepository(ISimpleApiClient client)

static Regex CreateRoute(string route)
{
// Build RegEx from route (:foo to named group (?<foo>[a-z0-9]+)).
var routeFormat = new Regex("(:([a-z]+))\\b").Replace(route, "(?<$2>[a-z0-9]+)");
// Build RegEx from route (:foo to named group (?<foo>[\w_.-]+)).
var routeFormat = new Regex("(:([a-z]+))\\b").Replace(route, @"(?<$2>[\w_.-]+)");
return new Regex(routeFormat, RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
}
}
Expand Down

0 comments on commit f55c19e

Please sign in to comment.