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

Commit ddce298

Browse files
committed
Allow blob URLs/disable when invalid URL
1 parent ddc6620 commit ddce298

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/GitHub.App/ViewModels/Dialog/Clone/RepositorySelectViewModel.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ public RepositorySelectViewModel(IRepositoryCloneService service, IGitHubContext
5050

5151
var filterRepository = this.WhenAnyValue(x => x.Filter)
5252
.Select(f => gitHubContextService.FindContextFromUrl(f))
53-
.Where(c => c?.LinkType == LinkType.Repository)
54-
.Select(c => new RepositoryModel(c.RepositoryName, c.Url));
53+
.Select(CreateRepository);
5554

5655
repository = selectedRepository
5756
.Merge(filterRepository)
@@ -198,5 +197,17 @@ RepositoryModel CreateRepository(IRepositoryItemViewModel item)
198197
new RepositoryModel(item.Name, UriString.ToUriString(item.Url)) :
199198
null;
200199
}
200+
201+
RepositoryModel CreateRepository(GitHubContext context)
202+
{
203+
switch (context?.LinkType)
204+
{
205+
case LinkType.Repository:
206+
case LinkType.Blob:
207+
return new RepositoryModel(context.RepositoryName, context.Url);
208+
}
209+
210+
return null;
211+
}
201212
}
202213
}

0 commit comments

Comments
 (0)