Fix #1406 searching repos with underscore in name (#1418)

This commit is contained in:
Brendan Forster
2016-07-14 14:20:07 -07:00
committed by Ryan Gribble
parent c25ba887b8
commit b47b05489e
2 changed files with 30 additions and 1 deletions
@@ -71,6 +71,35 @@ public class SearchClientTests
Assert.NotEmpty(repos.Items);
}
[IntegrationTest(Skip = "As this repository has been renamed, you cannot search for it's results.")]
public async Task SearchForFileNameInCodeWithoutTerm2()
{
var request = new SearchCodeRequest()
{
FileName = "project.json",
Repos = new RepositoryCollection { "adamcaudill/Psychson" }
};
var repos = await _gitHubClient.Search.SearchCode(request);
Assert.Empty(repos.Items);
}
[IntegrationTest]
public async Task SearchForFileNameInCodeWithoutTermWithUnderscore()
{
var request = new SearchCodeRequest()
{
FileName = "readme.md",
Repos = new RepositoryCollection { "Cultural-Rogue/_51Wp.XinFengSDK.Demo" }
};
var repos = await _gitHubClient.Search.SearchCode(request);
Assert.Empty(repos.Items);
}
[IntegrationTest]
public async Task SearchForWordInCode()
{
+1 -1
View File
@@ -122,7 +122,7 @@ namespace Octokit
// the rule:
// Username may only contain alphanumeric characters or single hyphens
// and cannot begin or end with a hyphen
static readonly Regex nameWithOwner = new Regex("[a-z0-9.-]{1,}/[a-z0-9.-]{1,}",
static readonly Regex nameWithOwner = new Regex("[a-z0-9.-]{1,}/[a-z0-9.-_]{1,}",
#if (!PORTABLE && !NETFX_CORE)
RegexOptions.Compiled |
#endif