Skip to content

Commit 7bb3c80

Browse files
committed
Fix URL creation in directory markdown
1 parent 6fe322b commit 7bb3c80

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/UpdateDirectory.mjs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,17 @@ function pathsToMarkdown (filePaths) {
5959
if (filepath) {
6060
++indent
6161
}
62-
const urls = [URL_BASE, filepath, filename]
63-
const url = urls.join('/').replace(' ', '%20')
62+
63+
// prepare the markdown-esque prefix to the file's line
64+
const prefix = pathPrefix(indent)
65+
6466
// remove extension from filename
65-
filename = filename.split('.')[0]
66-
output.push(`${pathPrefix(indent)} [${filename}](${url})`)
67+
const name = filename.split('.')[0]
68+
69+
// create URL to the actual file on github
70+
const url = encodeURI([URL_BASE, filepath, filename].join('/'))
71+
72+
output.push(`${prefix} [${name}](${url})`)
6773
}
6874

6975
return output.join('\n')

0 commit comments

Comments
 (0)