Skip to content

Commit 10f300b

Browse files
imsitnikovMaksim Sitnikov
authored andcommitted
Fix rewriteLinks for libraries (#505)
Co-authored-by: Maksim Sitnikov <[email protected]>
1 parent 9e79818 commit 10f300b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/Library/Library.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ export const Library: React.FC<Props> = ({lib}) => {
119119
return link;
120120
}
121121

122-
const githubRepoUrl = `${GITHUB_URL}${githubId}/blob/main/`;
123-
const absoluteUrl = new URL(link, githubRepoUrl);
124-
return absoluteUrl.toString();
122+
const githubRepoUrl = `${GITHUB_URL}${githubId}/blob/main/${
123+
link && link.startsWith('/') ? link.slice(1) : link
124+
}`;
125+
126+
return githubRepoUrl;
125127
},
126128
[lib.config?.githubId],
127129
);

0 commit comments

Comments
 (0)