@@ -23,18 +23,25 @@ set -e
2323[ " $( nvm_get_mirror node std) " = " https://nodejs.org/dist" ] || die " incorrect default node-std mirror"
2424[ " $( nvm_get_mirror iojs std) " = " https://iojs.org/dist" ] || die " incorrect default iojs-std mirror"
2525
26- NVM_NODEJS_ORG_MIRROR=" test ://domain"
27- [ " $( nvm_get_mirror node std) " = " test ://domain" ] || die " node-std mirror should respect NVM_NODEJS_ORG_MIRROR"
26+ NVM_NODEJS_ORG_MIRROR=" https ://test- domain"
27+ [ " $( nvm_get_mirror node std) " = " https ://test- domain" ] || die " node-std mirror should respect NVM_NODEJS_ORG_MIRROR"
2828unset NVM_NODEJS_ORG_MIRROR
2929
30- NVM_IOJS_ORG_MIRROR=" test ://domain"
31- [ " $( nvm_get_mirror iojs std) " = " test ://domain" ] || die " iojs-std mirror should respect NVM_IOJS_ORG_MIRROR"
30+ NVM_IOJS_ORG_MIRROR=" https ://test- domain"
31+ [ " $( nvm_get_mirror iojs std) " = " https ://test- domain" ] || die " iojs-std mirror should respect NVM_IOJS_ORG_MIRROR"
3232unset NVM_IOJS_ORG_MIRROR
3333
34- NVM_NODEJS_ORG_MIRROR=' `do something bad`'
35- ! nvm_get_mirror node std || die ' NVM_NODEJS_ORG_MIRROR errors with command injection attempt'
36- [ " $( nvm_get_mirror node std) " = " " ] || die ' NVM_NODEJS_ORG_MIRROR is protected against command injection'
34+ testMirrors () {
35+ NVM_NODEJS_ORG_MIRROR=" ${1-} "
36+ ! nvm_get_mirror node std || die " NVM_NODEJS_ORG_MIRROR errors with command injection attempt (${1-} )"
37+ [ " $( nvm_get_mirror node std) " = " " ] || die ' NVM_NODEJS_ORG_MIRROR is protected against command injection'
3738
38- NVM_IOJS_ORG_MIRROR=' `do something bad`'
39- ! nvm_get_mirror iojs std || die ' NVM_IOJS_ORG_MIRROR errors with command injection attempt'
40- [ " $( nvm_get_mirror iojs std) " = " " ] || die ' NVM_IOJS_ORG_MIRROR is protected against command injection'
39+ NVM_IOJS_ORG_MIRROR=" ${1-} "
40+ ! nvm_get_mirror iojs std || die " NVM_IOJS_ORG_MIRROR errors with command injection attempt (${1-} )"
41+ [ " $( nvm_get_mirror iojs std) " = " " ] || die ' NVM_IOJS_ORG_MIRROR is protected against command injection'
42+ }
43+
44+ testMirrors ' `do something bad`'
45+ testMirrors ' https://nodejs.org/dist; xdg-open http://www.google.com;'
46+ testMirrors ' https://nodejs.org/dist&&xdg-open http://www.google.com;'
47+ testMirrors ' https://nodejs.org/dist|xdg-open http://www.google.com;'
0 commit comments