From f9d9e8ff9241abe8e4569efec94621883586b6cd Mon Sep 17 00:00:00 2001 From: antuarc Date: Fri, 20 Sep 2024 14:40:11 +1000 Subject: [PATCH] [QOLDEV-933] don't show 'dataset not found' message when redirecting via PURL --- ckanext/qgov/common/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ckanext/qgov/common/plugin.py b/ckanext/qgov/common/plugin.py index e0da4b9..2e9dc86 100644 --- a/ckanext/qgov/common/plugin.py +++ b/ckanext/qgov/common/plugin.py @@ -154,9 +154,11 @@ def make_middleware(self, app, config): if hasattr(app, 'errorhandler'): @app.errorhandler(404) def handle_not_found(e): - from flask import redirect, request + from flask import redirect, request, get_flashed_messages redirect_url = urlm.get_purl_response(request.base_url) if redirect_url: + # eat the 'page not found' message as it's obsolete + get_flashed_messages() return redirect(redirect_url, 301) else: # copy default error handling