Fix url encoding of job names in jenkins input plugin (#7211)

This commit is contained in:
Harshit Bansal
2020-03-24 00:03:06 +05:30
committed by GitHub
parent 1d697dd323
commit a907edc1f3
2 changed files with 95 additions and 9 deletions

View File

@@ -73,7 +73,7 @@ const sampleConfig = `
## Optional Sub Job Per Layer
## In workflow-multibranch-plugin, each branch will be created as a sub job.
## This config will limit to call only the lasted branches in each layer,
## This config will limit to call only the lasted branches in each layer,
## empty will use default value 10
# max_subjob_per_layer = 10
@@ -442,12 +442,20 @@ func (jr jobRequest) combined() []string {
return append(jr.parents, jr.name)
}
func (jr jobRequest) combinedEscaped() []string {
jobs := jr.combined()
for index, job := range jobs {
jobs[index] = url.PathEscape(job)
}
return jobs
}
func (jr jobRequest) URL() string {
return "/job/" + strings.Join(jr.combined(), "/job/") + jobPath
return "/job/" + strings.Join(jr.combinedEscaped(), "/job/") + jobPath
}
func (jr jobRequest) buildURL(number int64) string {
return "/job/" + strings.Join(jr.combined(), "/job/") + "/" + strconv.Itoa(int(number)) + jobPath
return "/job/" + strings.Join(jr.combinedEscaped(), "/job/") + "/" + strconv.Itoa(int(number)) + jobPath
}
func (jr jobRequest) hierarchyName() string {