# Thus, we redirect the user to the same page but with the session cookie set.
# This will force using the database route dispatcher...
r = request.httprequest
- response = werkzeug.utils.redirect(r.url, 302)
+ url_redirect = r.base_url
+ if r.query_string:
+ # Can't use werkzeug.wrappers.BaseRequest.url with encoded hashes:
+ # https://github.com/amigrave/werkzeug/commit/b4a62433f2f7678c234cdcac6247a869f90a7eb7
+ url_redirect += '?' + r.query_string
+ response = werkzeug.utils.redirect(url_redirect, 302)
request.session.db = db
response = r.app.get_response(r, response, explicit_session=False)
werkzeug.exceptions.abort(response)