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 committed Jun 24, 2016
1 parent 1d34e28 commit 5532959
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions Octokit.Tests.Integration/Clients/SearchClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,22 @@ public async Task SearchForFileNameInCodeWithoutTerm2()
Repos = new RepositoryCollection { "adamcaudill/Psychson" }
};

try
{
var repos = await _gitHubClient.Search.SearchCode(request);

Assert.Empty(repos.Items);
}
catch (ApiValidationException ex)
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);
}

[IntegrationTest]
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 5532959

Please sign in to comment.