@@ -23,18 +23,25 @@ set -e
23
23
[ " $( nvm_get_mirror node std) " = " https://nodejs.org/dist" ] || die " incorrect default node-std mirror"
24
24
[ " $( nvm_get_mirror iojs std) " = " https://iojs.org/dist" ] || die " incorrect default iojs-std mirror"
25
25
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"
28
28
unset NVM_NODEJS_ORG_MIRROR
29
29
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"
32
32
unset NVM_IOJS_ORG_MIRROR
33
33
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'
37
38
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