diff --git a/report_custom_filename/controllers/report_controller.py b/report_custom_filename/controllers/report_controller.py index 6d034514..38e506f8 100644 --- a/report_custom_filename/controllers/report_controller.py +++ b/report_custom_filename/controllers/report_controller.py @@ -41,6 +41,9 @@ class ReportController(ReportController): @http.route(['/report/download']) def report_download(self, data, token): response = super(ReportController, self).report_download(data, token) + if response.status_code != 200: + # In case of error don't change the response. + return response # if we got another content disposition before, ditch the one added # by super() last_index = None diff --git a/report_custom_filename/controllers/reports.py b/report_custom_filename/controllers/reports.py index 77a830f2..c33b9980 100644 --- a/report_custom_filename/controllers/reports.py +++ b/report_custom_filename/controllers/reports.py @@ -13,6 +13,9 @@ class Reports(main.Reports): @main.serialize_exception def index(self, action, token): result = super(Reports, self).index(action, token) + if result.status_code != 200: + # In case of error don't change the response. + return result action = json.loads(action) context = dict(http.request.context) context.update(action["context"])