Skip to content

Commit

Permalink
Allow repository name parsing to have extra valid characters
Browse files Browse the repository at this point in the history
  • Loading branch information
saamorim committed Oct 10, 2018
1 parent b478682 commit 2b2f054
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions source/platforms/_tests/_pull_request_parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,13 @@ describe("parsing urls", () => {
repo: "projects/PROJ/repos/super-repo",
})
})

it("handles bitbucket server PRs (overview) with dashes in name", () => {
expect(
pullRequestParser("http://localhost:7990/projects/PROJ/repos/super-strong.repo_name/pull-requests/1/overview")
).toEqual({
pullRequestNumber: "1",
repo: "projects/PROJ/repos/super-strong.repo_name",
})
})
})
2 changes: 1 addition & 1 deletion source/platforms/pullRequestParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function pullRequestParser(address: string): PullRequestParts | null {

if (components && components.path) {
// shape: http://localhost:7990/projects/PROJ/repos/repo/pull-requests/1/overview
const parts = components.path.match(/(projects\/\w+\/repos\/[\w-]+)\/pull-requests\/(\d+)/)
const parts = components.path.match(/(projects\/\w+\/repos\/[\w-_.]+)\/pull-requests\/(\d+)/)
if (parts) {
return {
repo: parts[1],
Expand Down

0 comments on commit 2b2f054

Please sign in to comment.