From 105bb1f223c71c0d87366caed6ab0c2affaaa3cc Mon Sep 17 00:00:00 2001 From: Rackover Date: Fri, 5 Mar 2021 16:53:24 +0100 Subject: [PATCH] Fix path.join bug on http url --- app/map.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/map.js b/app/map.js index df0d103..b6f9ef4 100755 --- a/app/map.js +++ b/app/map.js @@ -45,12 +45,14 @@ async function scanDirectory(dirPath){ url: virtualPath, filePath: fullPath, cleanName: cleanName, - repoPath: path.join( + repoPath: + // DO NOT use path.join() here! Will strip the second slash from http:// process.env.GIT_REPO_URL .replace(":", "/") .replace("git@", "https://") - .replace(".git", "/blob/"+process.env.GIT_REPO_BRANCH), - virtualPath), + .replace(".git", "/blob/"+process.env.GIT_REPO_BRANCH) + + "/" + + virtualPath, name: markdown.parseMeta(contents.toString()).title || name, children: fs.existsSync(fullPathNoExt) ? await scanDirectory(fullPathNoExt) : false }