From 2712e54fc353c23f85bbe6351f684be842561f1f Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sat, 22 Jul 2023 11:22:24 -0700 Subject: [PATCH] utils: perform portable path sanitisation of URLs Some file systems have restrictions on character sets which are valid file name characters. Add a filter for the Windows file system character set restrictions. We replace them with `_` to match the behaviour in the DocC bundle generation after apple/swift-docc#668. --- src/utils/data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/data.js b/src/utils/data.js index fc1440457..6547f2d1b 100644 --- a/src/utils/data.js +++ b/src/utils/data.js @@ -56,7 +56,7 @@ export async function fetchData(path, params = {}, options = {}) { } function createDataPath(path) { - const dataPath = path.replace(/\/$/, ''); + const dataPath = path.replace(/\/$/, "").replace(/[<>:"\/\\|*]/, "_"); return `${normalizePath(['/data', dataPath])}.json`; }