-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix(destinations): Handle unicode characters in webhook notifications #7586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thank you for your contribution! And, if we create a test, I think the test should be in the file related to the class, like Also, I think the test is optional for this quite simple PR. |
Thankyou for yout comment! |
I think so, if we add the test. |
arikfr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on "webhook notifications would fail if they contained unicode characters in the alert data" -- when would it fail?
I would imagine something like this was needed in Python 2, but in Python 3 it uses Unicode strings which supposed to "just" work.
It will be beneficial if the test was reproducing the actual issue. In this case the test verifies we send bytes to requests.post, but does not really show case the error.
|
As written in the issue(#7468) PR author created, https://github.com/python/cpython/blob/main/Lib/http/client.py#L1405 https://github.com/python/cpython/blob/main/Lib/http/client.py#L166C1-L170C38 And, following https://requests.readthedocs.io/en/latest/api/ Here is the stack trace when the error happens: |
|
@yoshiokatsuneo thank you for the elaborate explanation! For a moment I thought that maybe we should use the |
84cb8c8 to
fa94b9a
Compare
updated |
Previously, webhook notifications would fail if they contained unicode characters in the alert data. This was because the JSON payload was not UTF-8 encoded before being sent. This commit fixes the issue by explicitly encoding the JSON data to UTF-8 and adds a test to verify the fix.
fa94b9a to
eee1947
Compare
|
I just approved and merged the PR. |
Previously, webhook notifications would fail if they contained unicode characters in the alert data. This was because the JSON payload was not UTF-8 encoded before being sent.
This commit fixes the issue by explicitly encoding the JSON data to UTF-8 and adds a test to verify the fix.
What type of PR is this?
Description
How is this tested?
Related Tickets & Documents
#7468
Mobile & Desktop Screenshots/Recordings (if there are UI changes)