Skip to content

Commit 0321aba

Browse files
committed
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 swiftlang/swift-docc#668.
1 parent 3dfc583 commit 0321aba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/data.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export async function fetchData(path, params = {}, options = {}) {
5656
}
5757

5858
function createDataPath(path) {
59-
const dataPath = path.replace(/\/$/, '');
59+
const dataPath = path.replace(/\/$/, "").replace(/[<>:"\/\\|*]/, "_");
6060
return `${normalizePath(['/data', dataPath])}.json`;
6161
}
6262

0 commit comments

Comments
 (0)