[Django] #25157: urlizetrunc changes existing link

3 views
Skip to first unread message

Django

unread,
Jul 21, 2015, 5:28:45 PM7/21/15
to django-...@googlegroups.com
#25157: urlizetrunc changes existing link
---------------------------------+--------------------
Reporter: dexity | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------
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?

--
Ticket URL: <https://code.djangoproject.com/ticket/25157>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 21, 2015, 5:30:39 PM7/21/15
to django-...@googlegroups.com
#25157: urlizetrunc changes existing link
---------------------------------+--------------------------------------

Reporter: dexity | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by dexity):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

> 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?

New description:

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?

--

--
Ticket URL: <https://code.djangoproject.com/ticket/25157#comment:1>

Django

unread,
Jul 21, 2015, 6:57:22 PM7/21/15
to django-...@googlegroups.com
#25157: urlizetrunc changes existing link
---------------------------------+--------------------------------------

Reporter: dexity | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by dexity):

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)}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25157#comment:2>

Django

unread,
Jul 21, 2015, 8:46:55 PM7/21/15
to django-...@googlegroups.com
#25157: urlizetrunc changes existing link
---------------------------------+--------------------------------------

Reporter: dexity | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by dexity):

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

--
Ticket URL: <https://code.djangoproject.com/ticket/25157#comment:3>

Django

unread,
Jul 21, 2015, 8:49:27 PM7/21/15
to django-...@googlegroups.com
#25157: urlizetrunc changes existing link
---------------------------------+--------------------------------------
Reporter: dexity | Owner: nobody
Type: Uncategorized | Status: closed

Component: Template system | Version: 1.8
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => wontfix


Comment:

Sorry for the regression, but
[https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#urlizetrunc
the documentation says], "As with urlize, this filter should only be
applied to plain text."

--
Ticket URL: <https://code.djangoproject.com/ticket/25157#comment:4>

Reply all
Reply to author
Forward
0 new messages