Skip to content

Commit

Permalink
Avoid showing URL-encoded labels
Browse files Browse the repository at this point in the history
Fixes #19
  • Loading branch information
fregante committed Feb 15, 2021
1 parent 46ed57e commit 9cddb98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -147,7 +147,7 @@ function shortenURL(href, currentUrl = 'https://github.com') {
}

if (label) {
return joinValues([repoUrl, label]) + `${search}${hash} (label)`;
return joinValues([repoUrl, decodeURIComponent(label)]) + `${search}${hash} (label)`;
}

if (isDependents) {
Expand Down
4 changes: 4 additions & 0 deletions test.js
Expand Up @@ -198,6 +198,10 @@ test('GitHub.com URLs', urlMatcherMacro, new Map([
'https://github.com/nodejs/node/labels/npm',
'nodejs/node/npm (label)'
],
[
'https://github.com/nodejs/node/labels/Please%21%20♥',
'nodejs/node/Please! ♥ (label)'
],
[
'https://github.com/fregante/shorten-repo-url/archive/6.4.1.zip',
'<code>6.4.1</code>.zip'
Expand Down

0 comments on commit 9cddb98

Please sign in to comment.