From abaa42af88d7862d80ea926bce3c6140c4acf8ee Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Wed, 15 Nov 2023 14:20:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=BC=E5=85=A5=E8=AF=81=E4=B9=A6?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20IP=20=E8=AF=81=E4=B9=A6=20(#2959)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/website_ssl.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/app/service/website_ssl.go b/backend/app/service/website_ssl.go index c3239bc49..3a62cd0c4 100644 --- a/backend/app/service/website_ssl.go +++ b/backend/app/service/website_ssl.go @@ -341,10 +341,18 @@ func (w WebsiteSSLService) Upload(req request.WebsiteSSLUpload) error { } else { newSSL.Organization = cert.Issuer.CommonName } + + var domains []string if len(cert.DNSNames) > 0 { newSSL.PrimaryDomain = cert.DNSNames[0] - newSSL.Domains = strings.Join(cert.DNSNames, ",") + domains = cert.DNSNames[1:] + } else if len(cert.IPAddresses) > 0 { + newSSL.PrimaryDomain = cert.IPAddresses[0].String() + for _, ip := range cert.IPAddresses[1:] { + domains = append(domains, ip.String()) + } } + newSSL.Domains = strings.Join(domains, ",") return websiteSSLRepo.Create(context.Background(), newSSL) }