From ebd5348e916370fccc07775e93584aae9791e5ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anes=20Hujevic=CC=81?= Date: Wed, 24 Apr 2024 18:28:49 +0200 Subject: [PATCH 1/2] Update extension.py to clean request.path before logging it --- flask_cors/extension.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_cors/extension.py b/flask_cors/extension.py index 6f76995..c0d522d 100644 --- a/flask_cors/extension.py +++ b/flask_cors/extension.py @@ -194,7 +194,7 @@ def cors_after_request(resp): for res_regex, res_options in resources: if try_match(normalized_path, res_regex): LOG.debug("Request to '%s' matches CORS resource '%s'. Using options: %s", - request.path, get_regexp_pattern(res_regex), res_options) + repr(request.path), get_regexp_pattern(res_regex), res_options) set_cors_headers(resp, res_options) break else: From 4052a972d10f0831926c8c577d277848b0bbc761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anes=20Hujevic=CC=81?= Date: Sat, 4 May 2024 19:17:32 +0200 Subject: [PATCH 2/2] Update extension.py to use string format specifier for cleaning request.path --- flask_cors/extension.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flask_cors/extension.py b/flask_cors/extension.py index c0d522d..6361dcc 100644 --- a/flask_cors/extension.py +++ b/flask_cors/extension.py @@ -193,8 +193,8 @@ def cors_after_request(resp): normalized_path = unquote_plus(request.path) for res_regex, res_options in resources: if try_match(normalized_path, res_regex): - LOG.debug("Request to '%s' matches CORS resource '%s'. Using options: %s", - repr(request.path), get_regexp_pattern(res_regex), res_options) + LOG.debug("Request to '%r' matches CORS resource '%s'. Using options: %s", + request.path, get_regexp_pattern(res_regex), res_options) set_cors_headers(resp, res_options) break else: