mirror of
https://github.com/apache/superset.git
synced 2026-06-07 08:39:25 +00:00
feat: do not redirect on 404/500 (#14724)
This commit is contained in:
@@ -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=[
|
||||
|
||||
Reference in New Issue
Block a user