Skip to content

Commit

Permalink
Fix path.join bug on http url
Browse files Browse the repository at this point in the history
  • Loading branch information
Rackover committed Mar 5, 2021
1 parent a494c4b commit 105bb1f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 105bb1f

Please sign in to comment.