Skip to content

Commit

Permalink
Fix pathname is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
kovsu committed Oct 30, 2024
1 parent fc0f933 commit ce4fcc4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function shortenRepoUrl(href, currentUrl = 'https://github.com') {
* Parse URL manually to avoid URL encoding and punycode
*/
const origin = href.split('/', 3).join('/');
const pathname = href.slice(origin.length).replace(/[?#].*/, '');
const pathname = href.slice(origin.length).replace(/[?#].*/, '') || '/';
const hash = /#.+$/.exec(href)?.[0] ?? '';

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

0 comments on commit ce4fcc4

Please sign in to comment.