Skip to content

Commit dd4dbfb

Browse files
authored
Fix relative URLs in getRepoURL (#29)
1 parent 0f1a310 commit dd4dbfb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ const getRepoPath = (url: URL | Location = location): string | undefined => {
474474
const getRepoURL = (url?: URL | Location): string => {
475475
if (!url) {
476476
const canonical = document.querySelector<HTMLMetaElement>('[property="og:url"]'); // `rel=canonical` doesn't appear on every page
477-
url = canonical ? new URL(canonical.content) : location;
477+
url = canonical ? new URL(canonical.content, location.origin) : location;
478478
}
479479

480480
return url.pathname.slice(1).split('/', 2).join('/');

0 commit comments

Comments
 (0)