@@ -47,10 +47,19 @@ var pluginOptionSanitizers = map[string]func(map[string]interface{}){
47
47
"gitextractor" : func (options map [string ]interface {}) {
48
48
if v , ok := options ["url" ]; ok {
49
49
gitUrl := cast .ToString (v )
50
- u , _ := url .Parse (gitUrl )
50
+ u , err := url .Parse (gitUrl )
51
+ if err != nil {
52
+ logger .Error (err , "failed to parse git url" , gitUrl )
53
+ }
51
54
if u != nil && u .User != nil {
52
55
password , ok := u .User .Password ()
53
56
if ok {
57
+ escapedUrl , err := url .QueryUnescape (gitUrl )
58
+ if err != nil {
59
+ logger .Warn (err , "failed to unescape url %s" , gitUrl )
60
+ } else {
61
+ gitUrl = escapedUrl
62
+ }
54
63
gitUrl = strings .Replace (gitUrl , password , strings .Repeat ("*" , len (password )), - 1 )
55
64
options ["url" ] = gitUrl
56
65
}
@@ -148,7 +157,8 @@ func SanitizeBlueprint(blueprint *models.Blueprint) error {
148
157
func SanitizePipeline (pipeline * models.Pipeline ) error {
149
158
for planStageIdx , pipelineStage := range pipeline .Plan {
150
159
for planTaskIdx := range pipelineStage {
151
- pipelineTask , err := SanitizeTask (pipeline.Plan [planStageIdx ][planTaskIdx ])
160
+ task := pipeline.Plan [planStageIdx ][planTaskIdx ]
161
+ pipelineTask , err := SanitizeTask (task )
152
162
if err != nil {
153
163
return err
154
164
}
0 commit comments