Skip to content
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] Can't send message with underscore character #11691

Closed
zolakk opened this issue Dec 2, 2021 · 1 comment · Fixed by #13758
Closed

[telegram] Can't send message with underscore character #11691

zolakk opened this issue Dec 2, 2021 · 1 comment · Fixed by #13758
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@zolakk
Copy link

zolakk commented Dec 2, 2021

I noticed when trying to set up a rule to send telegram messages when my zwave devices drop offline, I was getting the error "Failed to send telegram message: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 182". I narrowed it down by counting the characters and then attempting to send a message with just an _ in it, which resulted in "Failed to send telegram message: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 0"

Expected Behavior

The message should send without issue

Current Behavior

Attempting to send a message with a _ (underscore) character gives the message "Failed to send telegram message: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset ". Appears to happen with the sendTelegram, sendTelegramQuery, and sendTelegramQuery actions

Possible Solution

Internally escape the character before sending if it's an invalid character on the telegram API

Steps to Reproduce (for Bugs)

This python script:

telegramAction = actions.get("telegram","<botThingID>")
telegramAction.sendTelegram("_")
telegramAction.sendTelegramQuery("_")

will produce these lines in the log:

2021-12-02 11:14:26.246 [WARN ] [gram.internal.action.TelegramActions] - Failed to send telegram message: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 0

2021-12-02 11:14:26.407 [WARN ] [gram.internal.action.TelegramActions] - Failed to send telegram message: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 0

Context

I first noticed while trying to send a log snippet to my telegram with the text "COMMUNICATION_ERROR" in it but was failing with the above errors. I am able to work around that by replacing the underscore with a space but it would be good to not have to do that.

Your Environment

  • Version used: openHAB 3.2.0.M4
  • Operating System and version (desktop or mobile, Windows 10, Raspbian Buster, ...): Docker on raspbian buster
@zolakk zolakk added the bug An unexpected problem or unintended behavior of an add-on label Dec 2, 2021
clinique added a commit to clinique/openhab-addons that referenced this issue Nov 21, 2022
Signed-off-by: clinique <gael@lhopital.org>
clinique added a commit to clinique/openhab-addons that referenced this issue Nov 21, 2022
Signed-off-by: clinique <gael@lhopital.org>
clinique added a commit to clinique/openhab-addons that referenced this issue Nov 21, 2022
Signed-off-by: clinique <gael@lhopital.org>
lolodomo pushed a commit that referenced this issue Nov 21, 2022
Signed-off-by: clinique <gael@lhopital.org>
@lolodomo
Copy link
Contributor

Closed by #13758

andrasU pushed a commit to andrasU/openhab-addons that referenced this issue Dec 24, 2022
Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
borazslo pushed a commit to borazslo/openhab-mideaac-addon that referenced this issue Jan 8, 2023
Signed-off-by: clinique <gael@lhopital.org>
psmedley pushed a commit to psmedley/openhab-addons that referenced this issue Feb 23, 2023
Signed-off-by: clinique <gael@lhopital.org>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this issue Feb 28, 2023
Signed-off-by: clinique <gael@lhopital.org>
andrasU pushed a commit to andrasU/openhab-addons that referenced this issue Jan 6, 2024
Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants