MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / #safeName

Method #safeName

src/fileSystem/sftp.js:497–501  ·  view source on GitHub ↗

* * @param {String} name

(name)

Source from the content-addressed store, hash-verified

495 * @param {String} name
496 */
497 #safeName(name) {
498 const escapeCh = (str) => str.replace(/\\([^])|([`"])/g, "\\$1$2");
499 const ar = name.split("/");
500 return ar.map((dirname) => escapeCh(dirname)).join("/");
501 }
502
503 // #errorCodes(code, defaultMessage = strings["an error occurred"]) {
504 // switch (code) {

Callers 9

lsDirMethod · 0.95
createDirMethod · 0.95
writeFileMethod · 0.95
readFileMethod · 0.95
#copyFileMethod · 0.95
#copyDirectoryMethod · 0.95
renameMethod · 0.95
deleteMethod · 0.95
statMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected