Skip to content

Commit

Permalink
Fix octokit#1406 searching repos with underscore in name
Browse files Browse the repository at this point in the history
  • Loading branch information
dsplaisted authored and shiftkey committed Jul 11, 2016
1 parent 72e30a7 commit 54fd928
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions Octokit.Tests.Integration/Clients/SearchClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,35 @@ public async Task SearchForFileNameInCodeWithoutTerm()
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()
{
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Helpers/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static IEnumerable<string> SplitUpperCase(this string source)
// 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
Expand Down

0 comments on commit 54fd928

Please sign in to comment.