Fix certificate insertion loop to keep valid certificate and ignore the bad one

This commit is contained in:
Jean-Baptiste Doumenjou 2018-10-16 11:00:04 +02:00 committed by Traefiker Bot
parent c875819a2e
commit ba99fbe390
4 changed files with 35 additions and 16 deletions

View file

@ -196,6 +196,17 @@ func (c *Certificate) AppendCertificates(certs map[string]map[string]*tls.Certif
return err
}
func (c *Certificate) getTruncatedCertificateName() string {
certName := c.CertFile.String()
// Truncate certificate information only if it's a well formed certificate content with more than 50 characters
if !c.CertFile.IsPath() && strings.HasPrefix(certName, certificateHeader) && len(certName) > len(certificateHeader)+50 {
certName = strings.TrimPrefix(c.CertFile.String(), certificateHeader)[:50]
}
return certName
}
// String is the method to format the flag's value, part of the flag.Value interface.
// The String method's output will be used in diagnostics.
func (c *Certificates) String() string {