-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Telegram webhook #4227
Telegram webhook #4227
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4227 +/- ##
==========================================
- Coverage 41.67% 41.42% -0.26%
==========================================
Files 414 415 +1
Lines 55985 56337 +352
==========================================
+ Hits 23331 23335 +4
- Misses 29524 29873 +349
+ Partials 3130 3129 -1
Continue to review full report at Codecov.
|
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.
Could you add some tests ?
@sapk updated tests |
When created an issue, the webhook failed: {"ok":false,"error_code":400,"description":"Bad Request: can't parse entities: Unsupported start tag \"!--\" at byte offset 154"} |
thanks for testing @lunny. Can you post the the request that was made to telegram, I wonder if I need to escape anything. |
headers
body {
"text": "[\u003ca href=\"http://localhost:3000/lunny/git\"\u003elunny/git\u003c/a\u003e] Issue opened: \u003ca href=\"http://localhost:3000/api/v1/repos/lunny/git/issues/4\"\u003e#4 new issue\u003c/a\u003e\n\n\u003c!--\r\n 1. Please speak English, this is the language all of us can speak and write.\r\n 2. Please ask questions or configuration/deploy problems on our Discord \r\n server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io).\r\n 3. Please take a moment to check that your issue doesn't already exist.\r\n 4. Please give all relevant information below for bug reports, because \r\n incomplete details will be handled as an invalid report.\r\n--\u003e\r\n",
"parse_mode": "HTML"
} |
Looking at docs the only supported HTML tags are: So I'm going to try to instead send HTML to the API, I will try to transform this into markdown, and send it that way. |
@lunny @jonasfranz I'm now passing all messages through the sanitizer, and messages are successfully sending. |
@jonasfranz please review |
The root problem is that markdown shouldn't be mixed with HTML. The complete fix could be this: Refactor webhook #31587 |
As title