From e88da0be1b6ae1cc78743128f70c7e07cd49ebdd Mon Sep 17 00:00:00 2001 From: qinguoyi <1532979219@qq.com> Date: Sat, 3 Aug 2024 00:47:11 +0800 Subject: [PATCH] Fix KeyMaterial nil bug (#5848) --- weed/command/s3.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/weed/command/s3.go b/weed/command/s3.go index f4c7166c3..e568de91b 100644 --- a/weed/command/s3.go +++ b/weed/command/s3.go @@ -180,8 +180,11 @@ func runS3(cmd *Command, args []string) bool { } // GetCertificateWithUpdate Auto refreshing TSL certificate -func (S3opt *S3Options) GetCertificateWithUpdate(*tls.ClientHelloInfo) (*tls.Certificate, error) { - certs, err := S3opt.certProvider.KeyMaterial(context.Background()) +func (s3opt *S3Options) GetCertificateWithUpdate(*tls.ClientHelloInfo) (*tls.Certificate, error) { + certs, err := s3opt.certProvider.KeyMaterial(context.Background()) + if certs == nil { + return nil, err + } return &certs.Certs[0], err }