Skip to content

Commit

Permalink
utils: perform portable path sanitisation of URLs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
compnerd committed Jul 29, 2023
1 parent 3dfc583 commit 0321aba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
}

Expand Down

0 comments on commit 0321aba

Please sign in to comment.