Skip to content
This repository has been archived by the owner on Dec 28, 2017. It is now read-only.

Commit

Permalink
Fix parsing of TFS url in case collection name is contained in server…
Browse files Browse the repository at this point in the history
… name
  • Loading branch information
pascalberger committed Mar 20, 2017
1 parent 530d8c9 commit 609f6d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ public void Should_Throw_If_No_Valid_Url(string repoUrl, string expectedMessage)
@"http://mytenant.visualstudio.com/defaultcollection",
"myproject",
"myrepository")]
[InlineData(
@"http://tfs.foo.com/foo/foo/_git/foo",
"foo",
@"http://tfs.foo.com/foo",
"foo",
"foo")]
public void Should_Parse_Repo_Url(string repoUrl, string collectionName, string collectionurl, string projectName, string repositoryName)
{
// Given / When
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Prca.PullRequests.Tfs/RepositoryDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public RepositoryDescription(Uri repoUrl)
new Uri(
repoUrlString.Substring(
0,
repoUrlString.IndexOf(this.CollectionName, StringComparison.OrdinalIgnoreCase) + this.CollectionName.Length));
repoUrlString.IndexOf("/" + this.CollectionName + "/", StringComparison.OrdinalIgnoreCase) + this.CollectionName.Length + 1));
this.ProjectName = splitFirstPart.Last();
this.RepositoryName = splitLastPart.First();
}
Expand Down

0 comments on commit 609f6d2

Please sign in to comment.