From 5036619a6765a4487c5bf674fc610c507543d79e Mon Sep 17 00:00:00 2001 From: corubba Date: Thu, 23 Jun 2022 22:31:00 +0200 Subject: [PATCH] Allow new domains to be absolute Allow the new domain name to be input absolute (with a dot at the end). To keep the rest of the logic working as-is, remove it fairly early in the function. Would have loved to use `str.removesuffix()` but that's python v3.9+. --- powerdnsadmin/routes/domain.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/powerdnsadmin/routes/domain.py b/powerdnsadmin/routes/domain.py index 3261264..105a18d 100644 --- a/powerdnsadmin/routes/domain.py +++ b/powerdnsadmin/routes/domain.py @@ -363,6 +363,9 @@ def add(): 'errors/400.html', msg="Please enter a valid domain name"), 400 + if domain_name.endswith('.'): + domain_name = domain_name[:-1] + # If User creates the domain, check some additional stuff if current_user.role.name not in ['Administrator', 'Operator']: # Get all the account_ids of the user