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] Invalid escape of underscore character when sending messages #14204

Closed
MikeTheTux opened this issue Jan 11, 2023 · 2 comments · Fixed by #14314
Closed

[telegram] Invalid escape of underscore character when sending messages #14204

MikeTheTux opened this issue Jan 11, 2023 · 2 comments · Fixed by #14314
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@MikeTheTux
Copy link
Contributor

MikeTheTux commented Jan 11, 2023

It seems that #13758 was resolved incomplete.
When parseMode of Telegram Bot Thing is configured to None, underscore characters are now sent as \_ instead of _.

Expected Behavior

When parseMode is configured to None, sendTelegram("_") transmits "_" via Telegram

Current Behavior

When parseMode is configured to None, sendTelegram("_") transmits "\_" via Telegram

Possible Solution

The obvious fix would be to skip the changes from #13758 in case parseMode is configured to None.

But there is more fishy with #13758: Replacing _ by \_ will break any markdown formatting when using italic. There is already a comment on this in the PR #13758 (comment).
I guess #13758 needs to be fully reverted.
Instead the user documentation must be extended, stating that unwanted markdown characters need to be escaped by the user, when using parseMode Markdown.
E.g. result.replace("_", "\\_").replace("*", "\\*").replace("[", "\\[").replace("", "\")
Similar approach will be required when using HTML parseMode.

Steps to Reproduce (for Bugs)

  1. parseMode of Telegram Bot thing is configured to None
  2. telegramAction.sendTelegram("_")
  3. "_" is transmitted via Telegram

Context

Your Environment

  • OH 3.4.0
@MikeTheTux MikeTheTux added the bug An unexpected problem or unintended behavior of an add-on label Jan 11, 2023
@lsiepel
Copy link
Contributor

lsiepel commented Jan 25, 2023

Can confirm this issue.
@clinique are you aware of theses issues?

@Daniel-at-git
Copy link
Contributor

After I reverted 1d23c32 (in branch 3.4.x) it's working again.

@clinique: Please revert this commit or fix it in a way that it didn't affect other parts.

Daniel-at-git added a commit to Daniel-at-git/openhab-addons that referenced this issue Feb 1, 2023
…b#14204)

This PR reverts commit 1d23c32 and fix openhab#14204.

Signed-off-by: Daniel Schröter d.schroeter@gmx.de
Daniel-at-git added a commit to Daniel-at-git/openhab-addons that referenced this issue Feb 1, 2023
…b#14204)

This PR reverts commit 1d23c32 and fix openhab#14204.

Signed-off-by: Daniel Schröter d.schroeter@gmx.de
Signed-off-by: Daniel Schröter <d.schroeter@gmx.de>
lolodomo pushed a commit that referenced this issue Feb 2, 2023
#14314)

This PR reverts commit 1d23c32 and fix #14204.

Signed-off-by: Daniel Schröter <d.schroeter@gmx.de>
jlaur pushed a commit that referenced this issue Feb 7, 2023
#14314)

This PR reverts commit 1d23c32 and fix #14204.

Signed-off-by: Daniel Schröter <d.schroeter@gmx.de>
psmedley pushed a commit to psmedley/openhab-addons that referenced this issue Feb 23, 2023
…b#14204) (openhab#14314)

This PR reverts commit 1d23c32 and fix openhab#14204.

Signed-off-by: Daniel Schröter <d.schroeter@gmx.de>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this issue Feb 28, 2023
…b#14204) (openhab#14314)

This PR reverts commit 1d23c32 and fix openhab#14204.

Signed-off-by: Daniel Schröter <d.schroeter@gmx.de>
FordPrfkt pushed a commit to FordPrfkt/openhab-addons that referenced this issue Apr 20, 2023
…b#14204) (openhab#14314)

This PR reverts commit 1d23c32 and fix openhab#14204.

Signed-off-by: Daniel Schröter <d.schroeter@gmx.de>
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
3 participants