diff --git a/CHANGELOG.md b/CHANGELOG.md index c04c83fb..34af2094 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. ### Bug Fixes - Fix refreshing of the checks page filtered by tags (#221) +- Escape asterisks in Slack messages (#223) ## 1.5.0 - 2019-02-04 diff --git a/hc/front/templatetags/hc_extras.py b/hc/front/templatetags/hc_extras.py index d8306f84..c25182f5 100644 --- a/hc/front/templatetags/hc_extras.py +++ b/hc/front/templatetags/hc_extras.py @@ -114,3 +114,10 @@ def break_underscore(s): s = s.replace("_", "_\u200b") return s + + +@register.filter +def fix_asterisks(s): + """ Prepend asterisks with "Combining Grapheme Joiner" characters. """ + + return s.replace("*", "\u034f*") diff --git a/templates/integrations/slack_message.json b/templates/integrations/slack_message.json index 8983ec18..40338b3a 100644 --- a/templates/integrations/slack_message.json +++ b/templates/integrations/slack_message.json @@ -25,7 +25,7 @@ }, {% elif check.kind == "cron" %} {"title": "Schedule", - "value": "{{ check.schedule|escapejs }}", + "value": "{{ check.schedule|fix_asterisks|escapejs }}", "short": true }, {% endif %}