1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-08-10 22:31:47 +02:00

Fix config-import. Config with dkim key could not be imported.

This commit is contained in:
Dimitri Huisman
2023-04-07 14:19:17 +00:00
parent 60fc2b5679
commit c54271db32
2 changed files with 5 additions and 3 deletions

View File

@@ -574,8 +574,8 @@ class DkimKeyField(fields.String):
if value.lower() == '-generate-':
return dkim.gen_key()
# no key?
if not value:
# no key or key is <hidden>?
if not value or str(value) == '<hidden>':
return None
# remember part of value for ValidationError
@@ -610,7 +610,7 @@ class DkimKeyField(fields.String):
# check key validity
try:
serialization.load_pem_private_key(bytes(value, "ascii"), password=None)
serialization.load_pem_private_key(value, password=None)
except (UnicodeEncodeError, ValueError) as exc:
raise ValidationError(f'invalid dkim key {bad_key!r}') from exc
else:

View File

@@ -0,0 +1,2 @@
Fix breaking bug in config-import command line command.
Import yml's containing dkim keys (the element 'dkim_key:') failed to import using `config-import`.