From 398a9891eecd5fc5f17dc8664ff60b8836359976 Mon Sep 17 00:00:00 2001 From: Martin Varga Date: Wed, 13 May 2026 10:59:32 +0200 Subject: [PATCH] Do not log xml error responses --- server/mergin/app.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/server/mergin/app.py b/server/mergin/app.py index 41938d31..e5eb42d5 100644 --- a/server/mergin/app.py +++ b/server/mergin/app.py @@ -389,13 +389,16 @@ def handle_exception(e): def log_bad_request(response): """Log bad requests for easier debugging""" if response.status_code == 400: - json_body = response.get_json(silent=True) - if json_body and json_body.get("detail"): - # default response from connexion (check against swagger.yaml) - logging.warning(f'HTTP 400: {json_body["detail"]}') + if "xml" in response.content_type: + pass # QGIS proxy errors are already logged at the source else: - # either WTF form validation error or custom validation with abort(400) - logging.warning(f"HTTP 400: {response.data}") + json_body = response.get_json(silent=True) + if json_body and json_body.get("detail"): + # default response from connexion (check against swagger.yaml) + logging.warning(f'HTTP 400: {json_body["detail"]}') + else: + # either WTF form validation error or custom validation with abort(400) + logging.warning(f"HTTP 400: {response.data}") elif response.status_code == 409: # request which would result in conflict, e.g. creating the same project again logging.warning(f"HTTP 409: {response.data}")