Skip to content

Commit 138ab6d

Browse files
authored
Merge pull request #5315 from fazelukario/patch-1
Fix markdown issue in telegram notify hook
2 parents f6698d4 + 26c2fc2 commit 138ab6d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

notify/telegram.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ telegram_send() {
2727
fi
2828
_saveaccountconf_mutable TELEGRAM_BOT_CHATID "$TELEGRAM_BOT_CHATID"
2929

30-
_content="$(printf "%s" "$_content" | sed -e 's/\([_*`\[]\)/\\\\\1/g')"
30+
_subject="$(printf "%s" "$_subject" | sed 's/\\/\\\\\\\\/g' | sed 's/\]/\\\\\]/g' | sed 's/\([_*[()~`>#+--=|{}.!]\)/\\\\\1/g')"
31+
_content="$(printf "%s" "$_content" | sed 's/\\/\\\\\\\\/g' | sed 's/\]/\\\\\]/g' | sed 's/\([_*[()~`>#+--=|{}.!]\)/\\\\\1/g')"
3132
_content="$(printf "*%s*\n%s" "$_subject" "$_content" | _json_encode)"
3233
_data="{\"text\": \"$_content\", "
3334
_data="$_data\"chat_id\": \"$TELEGRAM_BOT_CHATID\", "
34-
_data="$_data\"parse_mode\": \"markdown\", "
35+
_data="$_data\"parse_mode\": \"MarkdownV2\", "
3536
_data="$_data\"disable_web_page_preview\": \"1\"}"
3637

3738
_debug "$_data"

0 commit comments

Comments
 (0)