diff --git a/models/__init__.py b/models/__init__.py index e94e3c2..390bca1 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -69,6 +69,8 @@ from askbot import mail from django import VERSION +import HTMLParser + #stores the 1.X version not the security release numbers DJANGO_VERSION = VERSION[:2] @@ -758,7 +760,8 @@ def user_assert_can_post_text(self, text): """Raises exceptions.PermissionDenied, if user does not have privilege to post given text, depending on the contents """ - if re.search(URL_RE, text): + html_parser = HTMLParser.HTMLParser() + if re.search(URL_RE, html_parser.unescape(text).lower()): min_rep = askbot_settings.MIN_REP_TO_SUGGEST_LINK if self.is_authenticated() and self.reputation < min_rep: message = _( diff --git a/utils/markup.py b/utils/markup.py index 61821bb..69476d2 100644 --- a/utils/markup.py +++ b/utils/markup.py @@ -12,8 +12,8 @@ from askbot.utils.html import urlize_html from django.utils.html import urlize from markdown2 import Markdown -#url taken from http://regexlib.com/REDetails.aspx?regexp_id=501 -URL_RE = re.compile("((?