From 8cfebc0c66b2287d8a7657c7bd79c46d610aba5b Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Thu, 20 May 2021 09:44:20 -0700 Subject: [PATCH] feat: do not redirect on 404/500 (#14724) --- superset/views/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/superset/views/base.py b/superset/views/base.py index d0b88748d92..74e05db5402 100644 --- a/superset/views/base.py +++ b/superset/views/base.py @@ -31,6 +31,7 @@ from flask import ( redirect, request, Response, + send_file, session, ) from flask_appbuilder import BaseView, Model, ModelView @@ -43,6 +44,7 @@ from flask_babel import get_locale, gettext as __, lazy_gettext as _ from flask_jwt_extended.exceptions import NoAuthorizationError from flask_wtf.csrf import CSRFError from flask_wtf.form import FlaskForm +from pkg_resources import resource_filename from sqlalchemy import or_ from sqlalchemy.orm import Query from werkzeug.exceptions import HTTPException @@ -390,7 +392,8 @@ def show_http_exception(ex: HTTPException) -> FlaskResponse: and not config["DEBUG"] and ex.code in {404, 500} ): - return redirect(f"/static/assets/{ex.code}.html") + path = resource_filename("superset", f"static/assets/{ex.code}.html") + return send_file(path) return json_errors_response( errors=[