This repository was archived by the owner on Dec 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,27 @@ import isGit from 'is-git-repository';
3
3
import { platform } from 'os' ;
4
4
import makepath from 'path' ;
5
5
import pathIsAbsolute from 'path-is-absolute' ;
6
+ import shellescape from 'shell-escape' ;
6
7
7
8
const cwd = process . cwd ( ) ;
8
9
10
+ // escape bad arguments
11
+ var escapeShell = function ( cmd ) {
12
+ if ( cmd !== undefined ) {
13
+ var arg = cmd . toString ( ) . split ( " " ) ;
14
+ return shellescape ( arg ) ;
15
+ }
16
+ }
17
+
9
18
const countGitTags = ( { path, local } = { } ) => {
10
19
let countOfTags = 0 ;
11
20
12
21
let thisPath = path || cwd ;
13
22
thisPath = pathIsAbsolute ( thisPath ) ? thisPath : makepath . join ( cwd , thisPath ) ;
14
23
const thisLocal = local === undefined ? true : local ;
24
+
25
+ thisPath = escapeShell ( thisPath ) ;
26
+ thisLocal = escapeShell ( thisLocal ) ;
15
27
16
28
if ( ! isGit ( thisPath ) ) {
17
29
return 0 ;
Original file line number Diff line number Diff line change 36
36
"execa" : " ^0.6.1" ,
37
37
"fs-extra" : " ^3.0.1" ,
38
38
"is-git-repository" : " ^1.1.1" ,
39
- "path-is-absolute" : " ^1.0.1"
39
+ "path-is-absolute" : " ^1.0.1" ,
40
+ "shell-escape" : " ^0.2.0"
40
41
},
41
42
"devDependencies" : {
42
43
"ava" : " ^0.18.2" ,
You can’t perform that action at this time.
0 commit comments