Code

Opened 4 years ago

Closed 4 years ago

Last modified 4 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: UI/UX:

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

Attachments (0)

Change History (2)

comment:1 Changed 4 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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 Changed 4 years ago by TomDunham

Many apologies, I should know to rtfm by now.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.