Skip to content

Commit

Permalink
[QOLDEV-933] don't show 'dataset not found' message when redirecting …
Browse files Browse the repository at this point in the history
…via PURL
  • Loading branch information
ThrawnCA committed Sep 20, 2024
1 parent 08bc656 commit f9d9e8f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ckanext/qgov/common/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f9d9e8f

Please sign in to comment.