diff --git a/plinth/modules/pagekite/forms.py b/plinth/modules/pagekite/forms.py index 805fde25b..e95ca3b42 100644 --- a/plinth/modules/pagekite/forms.py +++ b/plinth/modules/pagekite/forms.py @@ -67,11 +67,17 @@ class ConfigurationForm(forms.Form): old = _filter(self.initial) new = _filter(self.cleaned_data) + # Kite name should be ASCII. If it's unicode, convert to + # ASCII. + kite_name = str(new['kite_name']) + + # Let's Encrypt certificate paths use lower-case kite name. + kite_name = kite_name.lower() + if old != new: frontend = f"{new['server_domain']}:{new['server_port']}" utils.run([ - 'set-config', '--kite-name', new['kite_name'], '--frontend', - frontend + 'set-config', '--kite-name', kite_name, '--frontend', frontend ], input=new['kite_secret'].encode()) messages.success(request, _('Configuration updated')) diff --git a/plinth/modules/pagekite/tests/pagekite.feature b/plinth/modules/pagekite/tests/pagekite.feature index 3f6edb62c..8e4848725 100644 --- a/plinth/modules/pagekite/tests/pagekite.feature +++ b/plinth/modules/pagekite/tests/pagekite.feature @@ -23,6 +23,11 @@ Scenario: Configure pagekite application When I configure pagekite with host pagekite.example.com, port 8080, kite name mykite.example.com and kite secret mysecret Then pagekite should be configured with host pagekite.example.com, port 8080, kite name mykite.example.com and kite secret mysecret +Scenario: Capitalized kite name + Given the pagekite application is enabled + When I configure pagekite with host pagekite.example.com, port 8080, kite name Mykite.example.com and kite secret mysecret + Then pagekite should be configured with host pagekite.example.com, port 8080, kite name mykite.example.com and kite secret mysecret + @backups Scenario: Backup and restore pagekite Given the pagekite application is enabled