commit 199ab2d8ca6da72206327f57a3ac4782d38b9e05
parent ac27081f01517a2f6227d83e719389d804a0defd
Author: Damian Myrda <damian@prime8.dev>
Date: Sat, 31 Jan 2026 19:08:11 -0600
fix(git): handle relative links without ./ prefix
Now converts both ./LICENSE and LICENSE style links to full blob URLs.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/external/git.ts b/src/external/git.ts
@@ -64,14 +64,14 @@ function fixRelativePaths(urls: RepoUrls, markdown: string): string {
// blob = file browser URL (for links)
const blob = `${urls.web}/-/blob/${urls.branch}`;
markdown = markdown.replace(
- /(?<!!)\[([^\]]+)\]\(\.\/([^)]+)\)/g,
+ /(?<!!)\[([^\]]+)\]\((?!https?:\/\/)([^)]+)\)/g,
`[$1](${blob}/$2)`,
);
// raw = direct file content URL (for images)
const raw = `${urls.web}/-/raw/${urls.branch}`;
markdown = markdown.replace(
- /!\[([^\]]*)\]\(\.\/([^)]+)\)/g,
+ /!\[([^\]]*)\]\((?!https?:\/\/)([^)]+)\)/g,
``,
);