mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 18:35:51 +02:00
fix: parse ssl certificate error #270
This commit is contained in:
parent
e1c38e28a8
commit
371472e67b
5 changed files with 16 additions and 17 deletions
|
@ -25,7 +25,7 @@ func Transformer(certModel *model.Cert) (certificate *APICertificate) {
|
|||
if certModel.SSLCertificatePath != "" {
|
||||
if _, err := os.Stat(certModel.SSLCertificatePath); err == nil {
|
||||
sslCertificationBytes, _ = os.ReadFile(certModel.SSLCertificatePath)
|
||||
if !cert.IsPublicKey(string(sslCertificationBytes)) {
|
||||
if !cert.IsCertificate(string(sslCertificationBytes)) {
|
||||
sslCertificationBytes = []byte{}
|
||||
}
|
||||
}
|
||||
|
@ -77,9 +77,9 @@ func GetCert(c *gin.Context) {
|
|||
|
||||
type certJson struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
SSLCertificatePath string `json:"ssl_certificate_path" binding:"required,publickey_path"`
|
||||
SSLCertificatePath string `json:"ssl_certificate_path" binding:"required,certificate_path"`
|
||||
SSLCertificateKeyPath string `json:"ssl_certificate_key_path" binding:"required,privatekey_path"`
|
||||
SSLCertificate string `json:"ssl_certificate" binding:"omitempty,publickey"`
|
||||
SSLCertificate string `json:"ssl_certificate" binding:"omitempty,certificate"`
|
||||
SSLCertificateKey string `json:"ssl_certificate_key" binding:"omitempty,privatekey"`
|
||||
ChallengeMethod string `json:"challenge_method"`
|
||||
DnsCredentialID int `json:"dns_credential_id"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue