From 7bb3c80f052b8a4b09c5e6d3e6dea09388855b92 Mon Sep 17 00:00:00 2001 From: Roland Hummel Date: Tue, 5 Oct 2021 10:19:06 +0200 Subject: [PATCH] Fix URL creation in directory markdown --- .github/workflows/UpdateDirectory.mjs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/UpdateDirectory.mjs b/.github/workflows/UpdateDirectory.mjs index dc04b04a6..21b7db7e1 100644 --- a/.github/workflows/UpdateDirectory.mjs +++ b/.github/workflows/UpdateDirectory.mjs @@ -59,11 +59,17 @@ function pathsToMarkdown (filePaths) { if (filepath) { ++indent } - const urls = [URL_BASE, filepath, filename] - const url = urls.join('/').replace(' ', '%20') + + // prepare the markdown-esque prefix to the file's line + const prefix = pathPrefix(indent) + // remove extension from filename - filename = filename.split('.')[0] - output.push(`${pathPrefix(indent)} [${filename}](${url})`) + const name = filename.split('.')[0] + + // create URL to the actual file on github + const url = encodeURI([URL_BASE, filepath, filename].join('/')) + + output.push(`${prefix} [${name}](${url})`) } return output.join('\n')