From 043b329e7dcea44f8e7dd73622ac340235944e84 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Tue, 23 Mar 2021 08:22:44 -0400 Subject: [PATCH] config: Convert entered domain name to lower case Domain name is not case sensitive, but Let's Encrypt certificate paths use lower-case domain name. Closes: #1964. Tests: Config functional tests passed. Signed-off-by: James Valleroy Reviewed-by: Veiko Aasa --- plinth/modules/config/tests/config.feature | 4 ++++ plinth/modules/config/views.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/plinth/modules/config/tests/config.feature b/plinth/modules/config/tests/config.feature index eb90d751c..c18103011 100644 --- a/plinth/modules/config/tests/config.feature +++ b/plinth/modules/config/tests/config.feature @@ -15,6 +15,10 @@ Scenario: Change domain name When I change the domain name to mydomain.example Then the domain name should be mydomain.example +Scenario: Capitalized domain name + When I change the domain name to Mydomain.example + Then the domain name should be mydomain.example + Scenario: Change webserver home page Given the syncthing application is installed And the syncthing application is enabled diff --git a/plinth/modules/config/views.py b/plinth/modules/config/views.py index abc89095b..a88a6cde2 100644 --- a/plinth/modules/config/views.py +++ b/plinth/modules/config/views.py @@ -120,6 +120,10 @@ def set_domainname(domainname, old_domainname): # Domain name should be ASCII. If it's unicode, convert to ASCII. domainname = str(domainname) + # Domain name is not case sensitive, but Let's Encrypt certificate + # paths use lower-case domain name. + domainname = domainname.lower() + LOGGER.info('Changing domain name to - %s', domainname) actions.superuser_run('domainname-change', [domainname])