MCPcopy Create free account
hub / github.com/OpenSignLabs/OpenSign / sanitizeDownloadFilename

Function sanitizeDownloadFilename

apps/OpenSign/src/utils/fileUtils.js:77–82  ·  view source on GitHub ↗

* Remove characters not allowed in file names for major OSes.

(name)

Source from the content-addressed store, hash-verified

75 * Remove characters not allowed in file names for major OSes.
76 */
77function sanitizeDownloadFilename(name) {
78 return name
79 .replace(/[\\/:*?"<>|\u0000-\u001F]/g, " ") // reserved + control
80 .replace(/\s+/g, " ") // collapse spaces
81 .trim();
82}
83
84/**
85 * Build filename using the selected format ID and runtime values.

Callers 1

buildDownloadFilenameFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected