From 00a2e6bac2291ed83fb19eed4e7873fab7c7b2cc Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 19 Jun 2024 16:24:44 -0500 Subject: [PATCH] Website: Update relative link modification in build-static-content script (#19887) Closes: #19878 Changes: - Updated the regex that replaced spaces in relative links with dashes to also replace URL encoded space characters. --- website/scripts/build-static-content.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/scripts/build-static-content.js b/website/scripts/build-static-content.js index 3c29eb18ba..4228855219 100644 --- a/website/scripts/build-static-content.js +++ b/website/scripts/build-static-content.js @@ -281,7 +281,7 @@ module.exports = { throw new Error(`Could not build HTML partials from Markdown. A page (${pageRelSourcePath}) contains an invalid relative Markdown link (${hrefString.replace(/^href=/, '')}). To resolve, make sure all relative links on this page that link to a specific section include the Markdown page extension (.md) and try running this script again.`); } let referencedPageNewUrl = 'https://fleetdm.com/' + ( - (path.relative(topLvlRepoPath, referencedPageSourcePath).replace(/(^|\/)([^/]+)\.[^/]*$/, '$1$2').split(/\//).map((fileOrFolderName) => fileOrFolderName.toLowerCase().replace(/\s+/g, '-')).join('/')) + (path.relative(topLvlRepoPath, referencedPageSourcePath).replace(/(^|\/)([^/]+)\.[^/]*$/, '$1$2').split(/\//).map((fileOrFolderName) => fileOrFolderName.toLowerCase().replace(/%20|\s+/g, '-')).join('/')) .split(/\//).map((fileOrFolderName) => encodeURIComponent(fileOrFolderName.replace(/^[0-9]+[\-]+/,''))).join('/') ).replace(RX_README_FILENAME, ''); if(possibleReferencedUrlHash) {