diff --git a/kallithea/lib/helpers.py b/kallithea/lib/helpers.py
--- a/kallithea/lib/helpers.py
+++ b/kallithea/lib/helpers.py
@@ -36,7 +36,6 @@ from kallithea.lib.annotate import annot
#==============================================================================
from kallithea.lib.auth import HasPermissionAny, HasRepoGroupPermissionLevel, HasRepoPermissionLevel
from kallithea.lib.diffs import BIN_FILENODE, CHMOD_FILENODE, DEL_FILENODE, MOD_FILENODE, NEW_FILENODE, RENAMED_FILENODE
-from kallithea.lib.markup_renderer import url_re
from kallithea.lib.pygmentsutils import get_custom_lexer
from kallithea.lib.utils2 import (AttributeDict, age, asbool, credentials_filter, fmt_date, link_to_ref, safe_bytes, safe_int, safe_str, shorter,
time_to_datetime)
@@ -48,7 +47,7 @@ from kallithea.lib.vcs.exceptions import
from kallithea.lib.vcs.utils import author_email, author_name
from kallithea.lib.webutils import (HTML, MENTIONS_REGEX, Option, canonical_url, checkbox, chop_at, end_form, escape, form, format_byte_size, hidden,
html_escape, js, jshtml, link_to, literal, password, pop_flash_messages, radio, reset, safeid, select,
- session_csrf_secret_name, session_csrf_secret_token, submit, text, textarea, truncate, url, wrap_paragraphs)
+ session_csrf_secret_name, session_csrf_secret_token, submit, text, textarea, truncate, url, url_re, wrap_paragraphs)
from kallithea.model import db
from kallithea.model.changeset_status import ChangesetStatusModel
diff --git a/kallithea/lib/markup_renderer.py b/kallithea/lib/markup_renderer.py
--- a/kallithea/lib/markup_renderer.py
+++ b/kallithea/lib/markup_renderer.py
@@ -42,10 +42,6 @@ from kallithea.lib import webutils
log = logging.getLogger(__name__)
-url_re = re.compile(r'''\bhttps?://(?:[\da-zA-Z0-9@:.-]+)'''
- r'''(?:[/a-zA-Z0-9_=@#~&+%.,:;?!*()-]*[/a-zA-Z0-9_=@#~])?''')
-
-
class MarkupRenderer(object):
RESTRUCTUREDTEXT_DISALLOWED_DIRECTIVES = ['include', 'meta', 'raw']
@@ -163,7 +159,7 @@ class MarkupRenderer(object):
def url_func(match_obj):
url_full = match_obj.group(0)
return '%(url)s' % ({'url': url_full})
- source = url_re.sub(url_func, source)
+ source = webutils.url_re.sub(url_func, source)
return '
' + source.replace("\n", '
')
@classmethod
diff --git a/kallithea/lib/webutils.py b/kallithea/lib/webutils.py
--- a/kallithea/lib/webutils.py
+++ b/kallithea/lib/webutils.py
@@ -309,6 +309,10 @@ def jshtml(val):
return js(escape(val))
+url_re = re.compile(r'''\bhttps?://(?:[\da-zA-Z0-9@:.-]+)'''
+ r'''(?:[/a-zA-Z0-9_=@#~&+%.,:;?!*()-]*[/a-zA-Z0-9_=@#~])?''')
+
+
# Must match regexp in kallithea/public/js/base.js MentionsAutoComplete()
# Check char before @ - it must not look like we are in an email addresses.
# Matching is greedy so we don't have to look beyond the end.