Merge pull request #3772 from astroparam/escape-metacharacters
escape metacharacters in job name
This commit is contained in:
commit
4d90005817
2 changed files with 12 additions and 1 deletions
|
|
@ -462,7 +462,7 @@ func promptForJob(cs *iostreams.ColorScheme, jobs []shared.Job) (*shared.Job, er
|
|||
}
|
||||
|
||||
func logFilenameRegexp(job shared.Job, step shared.Step) *regexp.Regexp {
|
||||
re := fmt.Sprintf(`%s\/%d_.*\.txt`, job.Name, step.Number)
|
||||
re := fmt.Sprintf(`%s\/%d_.*\.txt`, regexp.QuoteMeta(job.Name), step.Number)
|
||||
return regexp.MustCompile(re)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -926,6 +926,17 @@ func Test_attachRunLog(t *testing.T) {
|
|||
},
|
||||
wantMatch: false,
|
||||
},
|
||||
{
|
||||
name: "escape metacharacters in job name",
|
||||
job: shared.Job{
|
||||
Name: "metacharacters .+*?()|[]{}^$ job",
|
||||
Steps: []shared.Step{{
|
||||
Name: "fob the barz",
|
||||
Number: 0,
|
||||
}},
|
||||
},
|
||||
wantMatch: false,
|
||||
},
|
||||
{
|
||||
name: "mismatching job name",
|
||||
job: shared.Job{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue