From 9890ddfa6414af78985b26b61ffbe2726cf54e59 Mon Sep 17 00:00:00 2001 From: corubba Date: Sun, 19 Jun 2022 12:16:40 +0200 Subject: [PATCH] Fix rrset changelog for names with hyphen When clicking the changelog button for a record with the name `foo-bar.example.org`, the url you get redirected to is `/domain/example.org/changelog/foo-bar.example.org.-A`. Because of the non-greedy behaviour of the path converter, the last part gets split at the *first* hyphen, so the example above gets wrongly dissected into `record_name=foo` and `record_type=bar.example.org.-A`. This results for obvious reasons in an empty changelog. As described in rfc5395 [0], types have to be alphanumerical, so its converter is changed from path to string. The hyphen is one of the few characters recommended by rfc1035 [1], so it is a bad choice as separator. The separator is instead changed to a slash. Granted, this does not entirely solve the issue but at least makes it a lot less likely to happen. Plus, a lot more and other things break in pda with slashes in names. [0] https://datatracker.ietf.org/doc/html/rfc5395#section-3.1 [1] https://datatracker.ietf.org/doc/html/rfc1035#section-2.3.1 --- powerdnsadmin/routes/domain.py | 2 +- powerdnsadmin/templates/domain.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/powerdnsadmin/routes/domain.py b/powerdnsadmin/routes/domain.py index 3261264..556bc19 100644 --- a/powerdnsadmin/routes/domain.py +++ b/powerdnsadmin/routes/domain.py @@ -277,7 +277,7 @@ def changelog(domain_name): """ Returns a changelog for a specific pair of (record_name, record_type) """ -@domain_bp.route('//changelog/-', methods=['GET']) +@domain_bp.route('//changelog//', methods=['GET']) @login_required @can_access_domain @history_access_required diff --git a/powerdnsadmin/templates/domain.html b/powerdnsadmin/templates/domain.html index d821e6a..f616967 100755 --- a/powerdnsadmin/templates/domain.html +++ b/powerdnsadmin/templates/domain.html @@ -190,7 +190,7 @@ function show_record_changelog(record_name, record_type, e) { e.stopPropagation(); - window.location.href = "/domain/{{domain.name}}/changelog/" + record_name + ".-" + record_type; + window.location.href = "/domain/{{domain.name}}/changelog/" + record_name + "./" + record_type; } // handle changelog button $(document.body).on("click", ".button_changelog", function(e) {