mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-11-18 10:29:43 +00:00
Fix certificate renewal (#209)
A database bug in xorm.go prevents the pages-server from saving a renewed certificate for a domain that already has one in the database. Co-authored-by: crystal <crystal@noreply.codeberg.org> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/209 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Crystal <crystal@noreply.codeberg.org> Co-committed-by: Crystal <crystal@noreply.codeberg.org>
This commit is contained in:
parent
26d59b71f0
commit
c40dddf471
2 changed files with 2 additions and 2 deletions
|
@ -64,7 +64,7 @@ func (x xDB) Put(domain string, cert *certificate.Resource) error {
|
||||||
}
|
}
|
||||||
defer sess.Close()
|
defer sess.Close()
|
||||||
|
|
||||||
if exist, _ := sess.ID(c.Domain).Exist(); exist {
|
if exist, _ := sess.ID(c.Domain).Exist(new(Cert)); exist {
|
||||||
if _, err := sess.ID(c.Domain).Update(c); err != nil {
|
if _, err := sess.ID(c.Domain).Update(c); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ func TestSanitizeWildcardCerts(t *testing.T) {
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// update existing cert
|
// update existing cert
|
||||||
assert.Error(t, certDB.Put(".wildcard.de", &certificate.Resource{
|
assert.NoError(t, certDB.Put(".wildcard.de", &certificate.Resource{
|
||||||
Domain: "*.wildcard.de",
|
Domain: "*.wildcard.de",
|
||||||
Certificate: localhost_mock_directory_certificate,
|
Certificate: localhost_mock_directory_certificate,
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Reference in a new issue