Skip to content

Commit

Permalink
[Fix JENKINS-32498] Fix problem fetching repo name from URI
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Mansilla committed Jan 28, 2016
1 parent e753b00 commit 6358b8b
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -173,8 +173,10 @@ private BitbucketBuildStatusResource createBuildStatusResourceFromBuild(final Ab

// extract bitbucket user name and repository name from repo URI
String repoUrl = urIish.getPath();

String repoName = repoUrl.substring(repoUrl.lastIndexOf("/") + 1, repoUrl.indexOf(".git"));
String repoName = repoUrl.substring(
repoUrl.lastIndexOf("/") + 1,
repoUrl.indexOf(".git") > -1 ? repoUrl.indexOf(".git") : repoUrl.length()
);
if (repoName.isEmpty()) {
throw new Exception("Bitbucket build notifier could not extract the repository name from the repository URL");
}
Expand Down

0 comments on commit 6358b8b

Please sign in to comment.