Skip to content

Commit

Permalink
fix: also include &&
Browse files Browse the repository at this point in the history
this is actually valid in filenames, but is SUPER unlikely so it's okay
  • Loading branch information
zacanger committed Jul 3, 2022
1 parent 4adbfc0 commit 995d4d7
Show file tree
Hide file tree
Showing 3 changed files with 1,067 additions and 2,155 deletions.
14 changes: 13 additions & 1 deletion index.js
@@ -1,6 +1,5 @@
const { readdirSync } = require('fs')
const { execSync } = require('child_process')
const sanitize = require('sanitize-filename')

const opts = {
stdio: 'ignore'
Expand Down Expand Up @@ -74,6 +73,19 @@ const isWindowsInstalled = (program) => {
return success
}

const sanitize = (program) => {
// from https://github.com/parshap/node-sanitize-filename/ licensed WTFPL/ISC
const illegalRe = /[\/\?<>\\:\*\|"]/g
const controlRe = /[\x00-\x1f\x80-\x9f]/g
const reservedRe = /^\.+$/
const probablyTwoThingsRe = /\&\&/g
return program
.replace(illegalRe, '')
.replace(controlRe, '')
.replace(reservedRe, '')
.replace(probablyTwoThingsRe, '')
}

module.exports = (program) => [
isUnixInstalled,
isMacInstalled,
Expand Down

0 comments on commit 995d4d7

Please sign in to comment.