diff --git a/pagure/templates/commit.html b/pagure/templates/commit.html index fed0887..53c0e60 100644 --- a/pagure/templates/commit.html +++ b/pagure/templates/commit.html @@ -212,7 +212,7 @@ {% if splitted_message|length > 1 %}
{% endif %} diff --git a/pagure/ui/filters.py b/pagure/ui/filters.py index cd388a6..e860f55 100644 --- a/pagure/ui/filters.py +++ b/pagure/ui/filters.py @@ -20,6 +20,7 @@ import textwrap import arrow import flask import six +import bleach from six.moves.urllib.parse import urlparse, parse_qsl from jinja2 import escape @@ -74,6 +75,17 @@ def format_ts(string): return arr.strftime("%Y-%m-%d %H:%M:%S %Z") +@UI_NS.app_template_filter("linkify") +def linkify_text(text): + """ escape all html tags with bleach, then use bleach to linkify + """ + if text: + cleaned = bleach.clean(text, tags=[], attributes=[]) + return bleach.linkify(cleaned) + else: + return "" + + @UI_NS.app_template_filter("format_loc") def format_loc( loc,