Skip to content

Commit ce4fcc4

Browse files
committed
Fix pathname is empty
1 parent fc0f933 commit ce4fcc4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function shortenRepoUrl(href, currentUrl = 'https://github.com') {
8484
* Parse URL manually to avoid URL encoding and punycode
8585
*/
8686
const origin = href.split('/', 3).join('/');
87-
const pathname = href.slice(origin.length).replace(/[?#].*/, '');
87+
const pathname = href.slice(origin.length).replace(/[?#].*/, '') || '/';
8888
const hash = /#.+$/.exec(href)?.[0] ?? '';
8989

9090
// Use URL exclusively for search parameters because they're too hard to parse

0 commit comments

Comments
 (0)