From 860030929de140de49f77894db658a8d25f459cd Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Wed, 8 Apr 2020 17:08:27 +0800 Subject: [PATCH] apis: proxy: fix sanitizing empty proxy string --- pkg/apis/cloudcommon/proxy/setting.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/apis/cloudcommon/proxy/setting.go b/pkg/apis/cloudcommon/proxy/setting.go index 14935acfb2..352aa0d8ae 100644 --- a/pkg/apis/cloudcommon/proxy/setting.go +++ b/pkg/apis/cloudcommon/proxy/setting.go @@ -19,14 +19,14 @@ func (v *ProxySetting) Sanitize() error { v.HttpProxy = strings.TrimSpace(v.HttpProxy) if u, err := parseProxy(v.HttpProxy); err != nil { return errors.Wrap(err, "invalid https_proxy url") - } else { + } else if u != nil { v.HttpProxy = u.String() } v.HttpsProxy = strings.TrimSpace(v.HttpsProxy) if u, err := parseProxy(v.HttpsProxy); err != nil { return errors.Wrap(err, "invalid http_proxy url") - } else { + } else if u != nil { v.HttpsProxy = u.String() }