Skip to content

Commit 38d392c

Browse files
committed
Add check for repoUrl
1 parent 2f16deb commit 38d392c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/markdown_renderers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export const customLinkRenderer = (href, text, repoUrl, gitBranchName) => {
154154
}
155155
// Only target relative URLs, which are used to refer to the git repo, and not anchors or absolute URLs
156156
const urlIsRelative = utils.isUrlRelative(href);
157-
if (urlIsRelative) {
157+
if (urlIsRelative && repoUrl) {
158158
const urlPrefix = generateGitRepoUrlPrefix(repoUrl, gitBranchName, href);
159159
// Since the README will always be in the root, the hrefs will have the same prefix, which needs to be taken off for the URL
160160
const cleanedHref = href.startsWith('./') ? href.replace('./', '') : href;
@@ -177,7 +177,7 @@ export const customLinkRenderer = (href, text, repoUrl, gitBranchName) => {
177177
export const customImageRenderer = (href, text, repoUrl, gitBranchName) => {
178178
// Only target relative URLs, which are used to refer to the git repo, and not anchors or absolute URLs
179179
const urlIsRelative = utils.isUrlRelative(href);
180-
if (urlIsRelative) {
180+
if (urlIsRelative && repoUrl) {
181181
const urlPrefix = generateRawGitRepoUrlPrefix(repoUrl, gitBranchName);
182182
// Since the README will always be in the root, the hrefs will have the same prefix, which needs to be taken off for the URL
183183
const cleanedHref = href.startsWith('./') ? href.replace('./', '') : href;

0 commit comments

Comments
 (0)