Skip to content

Commit

Permalink
cogito: properly encode spaces in url
Browse files Browse the repository at this point in the history
  • Loading branch information
aliculPix4D committed Mar 22, 2024
1 parent 7f0abe2 commit 35d30ac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cogito/putter.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,12 @@ func concourseBuildURL(env Environment) string {
// https://ci.example.com/teams/main/pipelines/cogito/jobs/autocat/builds/3?vars=%7B%22branch%22%3A%22stable%22%7D
if env.BuildPipelineInstanceVars != "" {
buildURL += fmt.Sprintf("?vars=%s", url.QueryEscape(env.BuildPipelineInstanceVars))
// Concourse requires that the space characters
// are encoded as %20 instead of +. On the other hand
// golangs url.QueryEscape as well as url.Values.Encode()
// both encode the space as a + character.
// See: https://github.com/golang/go/issues/4013
buildURL = strings.ReplaceAll(buildURL, "+", "%20")
}

return buildURL
Expand Down

0 comments on commit 35d30ac

Please sign in to comment.