diff --git a/swh/web/common/middlewares.py b/swh/web/common/middlewares.py --- a/swh/web/common/middlewares.py +++ b/swh/web/common/middlewares.py @@ -6,7 +6,11 @@ from htmlmin import minify -from swh.web.common.exc import handle_view_exception, sentry_capture_exception +from swh.web.common.exc import ( + BadInputExc, + handle_view_exception, + sentry_capture_exception, +) from swh.web.common.utils import prettify_html @@ -49,6 +53,8 @@ response.content.decode("utf-8"), convert_charrefs=False ) response.content = minified_html.encode("utf-8") + except BadInputExc: + pass except Exception as exc: sentry_capture_exception(exc) return response