mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-27 02:40:30 +00:00
pipeline compiler: handle nil entrys in settings list (#1626)
close #1609
This commit is contained in:
parent
1b43b0bf20
commit
9945e27c01
2 changed files with 10 additions and 0 deletions
|
@ -111,6 +111,11 @@ func sanitizeParamValue(v interface{}, secrets map[string]string) (string, error
|
|||
for i := 0; i < vv.Len(); i++ {
|
||||
v := vv.Index(i).Interface()
|
||||
|
||||
// if we handle a list with a nil entry we just return a empty list
|
||||
if v == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// ensure each element is not complex
|
||||
if isComplex(reflect.TypeOf(v).Kind()) {
|
||||
containsComplex = true
|
||||
|
|
|
@ -59,6 +59,11 @@ func TestParamsToEnv(t *testing.T) {
|
|||
got := map[string]string{}
|
||||
assert.NoError(t, ParamsToEnv(from, got, secrets))
|
||||
assert.EqualValues(t, want, got, "Problem converting plugin parameters to environment variables")
|
||||
|
||||
// handle edge cases (#1609)
|
||||
got = map[string]string{}
|
||||
assert.NoError(t, ParamsToEnv(map[string]interface{}{"a": []interface{}{"a", nil}}, got, nil))
|
||||
assert.EqualValues(t, map[string]string{"PLUGIN_A": "a,"}, got)
|
||||
}
|
||||
|
||||
func TestSanitizeParamKey(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue