From 2aa34498860e337683eddce0bbe115e362fa6b15 Mon Sep 17 00:00:00 2001 From: Amogh M Aradhya Date: Wed, 19 Jul 2023 14:49:55 +0530 Subject: [PATCH 1/2] Check if Matomo URL is ending with '/' --- src/baseframe/blueprint.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/baseframe/blueprint.py b/src/baseframe/blueprint.py index 57958a2d..bc70c8b3 100644 --- a/src/baseframe/blueprint.py +++ b/src/baseframe/blueprint.py @@ -141,6 +141,9 @@ def init_app( raise ValueError("App has misconfigured secret keys") app.session_interface = RotatingKeySecureCookieSessionInterface() + # Check if Matomo URL is ending with '/' or else add it + if app.config.get('MATOMO_URL') and not app.config['MATOMO_URL'].endswith('/'): + app.config['MATOMO_URL'] += '/' # Default .js and tracking file for Matomo if app.config.get('MATOMO_URL') and app.config.get('MATOMO_ID'): app.config.setdefault('MATOMO_JS', 'matomo.js') From c33d034fb61b8136860b91e6ab13df863317023b Mon Sep 17 00:00:00 2001 From: Amogh M Aradhya Date: Thu, 20 Jul 2023 11:38:08 +0530 Subject: [PATCH 2/2] Update blueprint.py --- src/baseframe/blueprint.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/baseframe/blueprint.py b/src/baseframe/blueprint.py index bc70c8b3..9ebe6870 100644 --- a/src/baseframe/blueprint.py +++ b/src/baseframe/blueprint.py @@ -141,13 +141,13 @@ def init_app( raise ValueError("App has misconfigured secret keys") app.session_interface = RotatingKeySecureCookieSessionInterface() - # Check if Matomo URL is ending with '/' or else add it - if app.config.get('MATOMO_URL') and not app.config['MATOMO_URL'].endswith('/'): - app.config['MATOMO_URL'] += '/' - # Default .js and tracking file for Matomo if app.config.get('MATOMO_URL') and app.config.get('MATOMO_ID'): + # Default .js and tracking file for Matomo app.config.setdefault('MATOMO_JS', 'matomo.js') app.config.setdefault('MATOMO_FILE', 'matomo.php') + # Check if Matomo URL is ending with '/' or else add it + if not app.config['MATOMO_URL'].endswith('/'): + app.config['MATOMO_URL'] += '/' statsd.init_app(app)