diff --git a/pkg/apis/minio.min.io/v2/helper.go b/pkg/apis/minio.min.io/v2/helper.go index 0055884f9ee..eba88bff2d3 100644 --- a/pkg/apis/minio.min.io/v2/helper.go +++ b/pkg/apis/minio.min.io/v2/helper.go @@ -1021,21 +1021,21 @@ func parsEnvEntry(envEntry string) (envKV, error) { Skip: true, }, nil } + if strings.HasPrefix(envEntry, "#") { + // Skip commented lines + return envKV{ + Skip: true, + }, nil + } const envSeparator = "=" envTokens := strings.SplitN(strings.TrimSpace(strings.TrimPrefix(envEntry, "export")), envSeparator, 2) if len(envTokens) != 2 { return envKV{}, fmt.Errorf("envEntry malformed; %s, expected to be of form 'KEY=value'", envEntry) } + key := envTokens[0] val := envTokens[1] - if strings.HasPrefix(key, "#") { - // Skip commented lines - return envKV{ - Skip: true, - }, nil - } - // Remove quotes from the value if found if len(val) >= 2 { quote := val[0] @@ -1043,6 +1043,7 @@ func parsEnvEntry(envEntry string) (envKV, error) { val = val[1 : len(val)-1] } } + return envKV{ Key: key, Value: val,