mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-15 01:32:57 -07:00
Fix notificaiton parameter prefix and suffix not being substituted correctly
This commit is contained in:
parent
08714436c3
commit
c2185c4ce5
1 changed files with 9 additions and 4 deletions
|
@ -1101,6 +1101,8 @@ def build_notify_text(subject='', body='', notify_action=None, parameters=None,
|
||||||
|
|
||||||
|
|
||||||
def strip_tag(data, agent_id=None):
|
def strip_tag(data, agent_id=None):
|
||||||
|
# Substitute temporary tokens for < and > in parameter prefix and suffix
|
||||||
|
data = re.sub(r'{.+?}', lambda m: m.group().replace('<', '%temp_lt_token%').replace('>', '%temp_gt_token%'), data)
|
||||||
|
|
||||||
if agent_id == 7:
|
if agent_id == 7:
|
||||||
# Allow tags b, i, u, a[href], font[color] for Pushover
|
# Allow tags b, i, u, a[href], font[color] for Pushover
|
||||||
|
@ -1109,11 +1111,11 @@ def strip_tag(data, agent_id=None):
|
||||||
'u': [],
|
'u': [],
|
||||||
'a': ['href'],
|
'a': ['href'],
|
||||||
'font': ['color']}
|
'font': ['color']}
|
||||||
return bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
data = bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
||||||
|
|
||||||
elif agent_id in (10, 14, 20):
|
elif agent_id in (10, 14, 20):
|
||||||
# Don't remove tags for Email, Slack, and Discord
|
# Don't remove tags for Email, Slack, and Discord
|
||||||
return data
|
pass
|
||||||
|
|
||||||
elif agent_id == 13:
|
elif agent_id == 13:
|
||||||
# Allow tags b, i, code, pre, a[href] for Telegram
|
# Allow tags b, i, code, pre, a[href] for Telegram
|
||||||
|
@ -1122,11 +1124,14 @@ def strip_tag(data, agent_id=None):
|
||||||
'code': [],
|
'code': [],
|
||||||
'pre': [],
|
'pre': [],
|
||||||
'a': ['href']}
|
'a': ['href']}
|
||||||
return bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
data = bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
whitelist = {}
|
whitelist = {}
|
||||||
return bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
data = bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
||||||
|
|
||||||
|
# Resubstitute temporary tokens for < and > in parameter prefix and suffix
|
||||||
|
return data.replace('%temp_lt_token%', '<').replace('%temp_gt_token%', '>')
|
||||||
|
|
||||||
|
|
||||||
def format_group_index(group_keys):
|
def format_group_index(group_keys):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue