bito-code-review[bot] commented on PR #38744:
URL: https://github.com/apache/superset/pull/38744#issuecomment-4110233400
<!-- Bito Reply -->
Yes, the code change introduces duplicate logging for unparseable form_data.
The except block logs an error on JSONDecodeError, and then the subsequent if
json_body is None block logs another error, leading to two entries for a single
failure.
**superset/charts/data/api.py**
```
try:
json_body = json.loads(request.form["form_data"])
except (TypeError, json.JSONDecodeError):
logger.error(
"Failed to parse form_data JSON: "
"content_type=%s, content_length=%s,
form_data_length=%s, "
"referrer=%s",
request.content_type,
request.content_length,
len(request.form.get("form_data", "")),
request.referrer,
)
if json_body is None:
logger.error(
"Chart data request rejected: json_body is None. "
"is_json=%s, content_type=%s, content_length=%s, "
"has_form_data=%s, referrer=%s",
request.is_json,
request.content_type,
request.content_length,
bool(request.form.get("form_data")),
request.referrer,
)
return self.response_400(message=_("Request is not JSON"))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]