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

Commit e75770f

Browse files
committed
Replacing spaces with dashes in PULL_REQUEST_URL #82
* Was evaluating to wrong URL if repo name included spaces.
1 parent 83a44b8 commit e75770f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
Changelog of Pull Request Notifier for Stash.
44

5+
## 1.36
6+
* Bugfix: Replacing spaces with dashes in ${PULL_REQUEST_URL}. Was evaluating to wrong URL if repo name included spaces.
7+
58
## 1.35
69
* Processing events on Bitbucket Server's event threads
710

src/main/java/se/bjurr/prnfs/listener/PrnfsRenderer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,9 @@ private static String cloneUrlFromRepository(REPO_PROTOCOL protocol, Repository
380380
}
381381

382382
private static String getPullRequestUrl(ApplicationPropertiesService propertiesService, PullRequest pullRequest) {
383-
return propertiesService.getBaseUrl() + "/projects/" + pullRequest.getToRef().getRepository().getProject().getKey()
384-
+ "/repos/" + pullRequest.getToRef().getRepository().getName() + "/pull-requests/" + pullRequest.getId();
383+
return (propertiesService.getBaseUrl() + "/projects/" + pullRequest.getToRef().getRepository().getProject().getKey()
384+
+ "/repos/" + pullRequest.getToRef().getRepository().getName() + "/pull-requests/" + pullRequest.getId())
385+
.replaceAll(" ", "-");
385386
}
386387

387388
PrnfsVariable(Resolver resolver) {

src/test/java/se/bjurr/prnfs/admin/PrnfsPullRequestEventListenerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ public void testThatAUrlWithVariablesExceptFromAndToCanBeInvoked() throws Except
413413
.withToRef( //
414414
pullRequestRefBuilder() //
415415
.withProjectKey("theProject") //
416-
.withRepositoryName("theRepoName") //
416+
.withRepositoryName("the Repo Name") //
417417
) //
418418
.withPullRequestAction(OPENED) //
419419
.withAuthor( //
@@ -429,7 +429,7 @@ public void testThatAUrlWithVariablesExceptFromAndToCanBeInvoked() throws Except
429429
) //
430430
.invokedUrl(
431431
0,
432-
"http://bjurr.se/id=10&action=OPENED&displayName=authorDisplayName&authorEmail=authorEmail&authorId=100&authorName=authorName&authorSlug=authorSlug&pullRequestUrl=http%3A%2F%2Fstash.server%2Fprojects%2FtheProject%2Frepos%2FtheRepoName%2Fpull-requests%2F10" //
432+
"http://bjurr.se/id=10&action=OPENED&displayName=authorDisplayName&authorEmail=authorEmail&authorId=100&authorName=authorName&authorSlug=authorSlug&pullRequestUrl=http%3A%2F%2Fstash.server%2Fprojects%2FtheProject%2Frepos%2Fthe-Repo-Name%2Fpull-requests%2F10" //
433433
);
434434
}
435435

0 commit comments

Comments
 (0)