Opened 9 years ago

Closed 9 years ago

#25157 closed Uncategorized (wontfix)

urlizetrunc changes existing link

Reported by: dexity Owned by: nobody
Component: Template system Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by dexity)

urlizetrunc in 1.7x is used to not modify existing link. E.g. 'foo<a href=" google.com ">bar</a>buz' remains unchanged. In 1.8x it changes to something like: 'foo&lt;a href=&quot; <a href="http://google.com" rel="nofollow">google.com</a> &quot;&gt;bar&lt;/a&gt;buz' (https://github.com/django/django/blob/master/tests/template_tests/filter_tests/test_urlizetrunc.py)

Could you fix so that it doesn't change the existing links?

Change History (4)

comment:1 by dexity, 9 years ago

Description: modified (diff)

comment:2 by dexity, 9 years ago

I think the problem is with simple_url_2_re in Django 1.8.

re.compile(r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org)($|/.*)$', re.IGNORECASE)


In Django 1.7 it was

re.compile(r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org)$', re.IGNORECASE)

comment:3 by dexity, 9 years ago

I mock patched simple_url_2_re from Django 1.7 and it works as expected (existing link doesn't change).

comment:4 by Tim Graham, 9 years ago

Resolution: wontfix
Status: newclosed

Sorry for the regression, but the documentation says, "As with urlize, this filter should only be applied to plain text."

Note: See TracTickets for help on using tickets.
Back to Top