Repository navigation
fix(Query): Parse html string error responses to avoid displaying raw HTML as error message - #29321
Conversation
mistercrunch
left a comment
There was a problem hiding this comment.
Given everything, this overall LGTM. If the html-handling module tends to grow in the future I'd advocate to refactor using cheerio, but for now I'd rather maintain the logic here than adding a dependency.
|
In the latest commit I've tried preserving the I've also added a final check to the error message if the response is incapable of being read as a |
mistercrunch
left a comment
There was a problem hiding this comment.
Let's address the t() comment, but otherwise LGTM, feel free to address the naming-related comments or save it for another PR
|
I'll save the name change for a new PR just so it becomes the focus in case I miss any usage cases across the codebase when replacing the calls to it. |
d54c418 to
e325a7d
Compare
… HTML as error message (apache#29321) (cherry picked from commit de6a518)
… HTML as error message (#29321)
… HTML as error message (apache#29321)

SUMMARY
Adds a function to check if a string is HTML and not capable of JSON parsing to ensure the client does not show raw HTML where there should be an error message.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ChartDataRestApiresponse for aPOSTmethod to be an error with themessagekwargcontaining raw html in string form. e.g.self.response_500(message='<html><div>Error</div></html>')See moreon the unexpected error alert produced by charts.Server erroror, in the case of a detected 404,Not found.ADDITIONAL INFORMATION