From fcb5ec640fb46b8b870e95e7ac4837e01b592377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anthony=20G=C3=A9go?= Date: Wed, 24 Nov 2021 10:47:02 +0100 Subject: [PATCH] [common/utils] consider not matching paths as static --- ictv/common/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ictv/common/utils.py b/ictv/common/utils.py index 2e5ef11..f2a2139 100644 --- a/ictv/common/utils.py +++ b/ictv/common/utils.py @@ -35,6 +35,7 @@ from ictv.models.role import UserPermissions from ictv.models.user import User +from werkzeug.exceptions import NotFound import ictv.flask.response as resp @@ -245,6 +246,9 @@ def get_methods(elem): return [m for m in http_methods if elem.__dict__.get(m.lower())!=None] def request_static(): - endpoint, _ = flask.current_app.create_url_adapter(flask.request).match() + try: + endpoint, _ = flask.current_app.create_url_adapter(flask.request).match() + except NotFound: + return True return endpoint == 'static' - \ No newline at end of file +