mirror of https://github.com/caronc/apprise
Escape < > characters for Telegram (#384)
parent
c4fa92824d
commit
7f7ee043d9
|
@ -547,8 +547,17 @@ class NotifyTelegram(NotifyBase):
|
||||||
body,
|
body,
|
||||||
)
|
)
|
||||||
|
|
||||||
else: # TEXT
|
else: # pass directly as is...
|
||||||
payload['parse_mode'] = 'HTML'
|
payload['parse_mode'] = 'HTML'
|
||||||
|
|
||||||
|
# Telegram strangely escapes all HTML characters for us already
|
||||||
|
# but to avoid causing issues with HTML, we escape the < and >
|
||||||
|
# characters
|
||||||
|
title = re.sub('>', '>', title, re.I)
|
||||||
|
title = re.sub('<', '<', title, re.I)
|
||||||
|
body = re.sub('>', '>', body, re.I)
|
||||||
|
body = re.sub('<', '<', body, re.I)
|
||||||
|
|
||||||
payload['text'] = '{}{}'.format(
|
payload['text'] = '{}{}'.format(
|
||||||
'<b>{}</b>\r\n'.format(title) if title else '',
|
'<b>{}</b>\r\n'.format(title) if title else '',
|
||||||
body,
|
body,
|
||||||
|
|
Loading…
Reference in New Issue