Skip to content

Commit

Permalink
Linkify non-URL-friendly branch names in PRs (refined-github#986)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante authored Jan 12, 2018
1 parent 45877ee commit 1a1df5c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/features/linkify-branch-refs.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ export function inPR() {
// Find the URLs first, some elements don't have titles
const urls = new Map();
for (const el of select.all('.commit-ref[title], .base-ref[title], .head-ref[title]')) {
urls.set(el.textContent.trim(), '/' + el.title.replace(':', '/tree/'));
const [repo, branch] = el.title.split(':');
urls.set(
el.textContent.trim(),
`/${repo}/tree/${encodeURIComponent(branch)}`
);
}

for (const el of select.all('.commit-ref')) {
Expand Down

0 comments on commit 1a1df5c

Please sign in to comment.