Merge pull request #4192 from matrix-org/travis/fix-consent-urls

Remove duplicate slashes in generated consent URLs
This commit is contained in:
Travis Ralston 2018-11-16 09:40:50 -07:00 committed by GitHub
commit 0bb273db07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 4 deletions

1
changelog.d/4192.bugfix Normal file
View file

@ -0,0 +1 @@
Fix an issue where public consent URLs had two slashes.

View file

@ -473,7 +473,7 @@ class AuthHandler(BaseHandler):
"version": self.hs.config.user_consent_version, "version": self.hs.config.user_consent_version,
"en": { "en": {
"name": self.hs.config.user_consent_policy_name, "name": self.hs.config.user_consent_policy_name,
"url": "%s/_matrix/consent?v=%s" % ( "url": "%s_matrix/consent?v=%s" % (
self.hs.config.public_baseurl, self.hs.config.public_baseurl,
self.hs.config.user_consent_version, self.hs.config.user_consent_version,
), ),

View file

@ -161,7 +161,7 @@ class AuthRestServlet(RestServlet):
html = TERMS_TEMPLATE % { html = TERMS_TEMPLATE % {
'session': session, 'session': session,
'terms_url': "%s/_matrix/consent?v=%s" % ( 'terms_url': "%s_matrix/consent?v=%s" % (
self.hs.config.public_baseurl, self.hs.config.public_baseurl,
self.hs.config.user_consent_version, self.hs.config.user_consent_version,
), ),
@ -242,7 +242,7 @@ class AuthRestServlet(RestServlet):
else: else:
html = TERMS_TEMPLATE % { html = TERMS_TEMPLATE % {
'session': session, 'session': session,
'terms_url': "%s/_matrix/consent?v=%s" % ( 'terms_url': "%s_matrix/consent?v=%s" % (
self.hs.config.public_baseurl, self.hs.config.public_baseurl,
self.hs.config.user_consent_version, self.hs.config.user_consent_version,
), ),

View file

@ -43,7 +43,7 @@ class TermsTestCase(unittest.HomeserverTestCase):
def test_ui_auth(self): def test_ui_auth(self):
self.hs.config.user_consent_at_registration = True self.hs.config.user_consent_at_registration = True
self.hs.config.user_consent_policy_name = "My Cool Privacy Policy" self.hs.config.user_consent_policy_name = "My Cool Privacy Policy"
self.hs.config.public_baseurl = "https://example.org" self.hs.config.public_baseurl = "https://example.org/"
self.hs.config.user_consent_version = "1.0" self.hs.config.user_consent_version = "1.0"
# Do a UI auth request # Do a UI auth request