Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#13504 closed (invalid)

urlize corrupts links in paras

Reported by: TomDunham Owned by: nobody
Component: Template system Version: 1.1
Severity: 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

Came across this after running urlize on some text that had been through markdown.

In [14]: from django.utils import html

In [15]: html.urlize("<p>http://a.com</p>")
Out[15]: u'<p>http://a.com</p>'   ## That was a surprise 

In [16]: html.urlize("<p> http://a.com</p>")
Out[16]: u'<p> <a href="http://a.com%3C/p">http://a.com</p</a>>'  ## That can't be right

Django==1.1.1

Change History (2)

comment:1 by Karen Tracey, 14 years ago

Resolution: invalid
Status: newclosed

The fact that urlize does not work properly on already-marked-up text is a documented restriction. From: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#urlize: "Note that if urlize is applied to text that already contains HTML markup, things won't work as expected. Apply this filter only to plain text."

comment:2 by TomDunham, 14 years ago

Many apologies, I should know to rtfm by now.

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