Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Match repos with a trailing / or .git
  • Loading branch information
jcansdale committed Feb 4, 2019
commit fde9cb1f79cc3fdc43c530d7a567cf14303d93cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,14 @@ bool FilterItem(object obj)
{
if (obj is IRepositoryItemViewModel item && !string.IsNullOrWhiteSpace(Filter))
{
var urlString = item.Url.ToString();
var urlStringWithGit = urlString + ".git";
var urlStringWithSlash = urlString + "/";
return
item.Caption.Contains(Filter, StringComparison.CurrentCultureIgnoreCase) ||
item.Url.ToString().Contains(Filter, StringComparison.OrdinalIgnoreCase);
urlString.Contains(Filter, StringComparison.OrdinalIgnoreCase) ||
urlStringWithGit.Contains(Filter, StringComparison.OrdinalIgnoreCase) ||
urlStringWithSlash.Contains(Filter, StringComparison.OrdinalIgnoreCase);
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class TheFilterProperty
[TestCase("HTTPS://GITHUB.COM/OWNER/NAME", "owner", "name", "https://github.com/owner/name", 1)]
[TestCase("https://github.com/owner", "owner", "name", "https://github.com/owner/name", 1)]
[TestCase("https://github.com/jcansdale/TestDriven.Net", "owner", "name", "https://github.com/jcansdale/TestDriven.Net-issues", 1)]
[TestCase("https://github.com/owner/name/", "owner", "name", "https://github.com/owner/name", 1, Description = "Trailing slash")]
[TestCase("https://github.com/owner/name.git", "owner", "name", "https://github.com/owner/name", 1, Description = "Trailing .git")]
public async Task Filter(string filter, string owner, string name, string url, int expectCount)
{
var contributedToRepositories = new[]
Expand Down