Opened 8 years ago

Closed 8 years ago

#26958 closed Bug (invalid)

Django urlize inside html tags

Reported by: Henrique Chehad Owned by: nobody
Component: Template system Version: 1.9
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

Hello.

The urlize is processing urls inside params.

It is adding "<a href=" inside attributes.

Example:

>>> from django.utils.html import urlize
>>> text = "<img src=\"https://www.url.com/image.jpg\">"
>>> urlize(text)


u'<img src="<a href="https://www.url.com/image.jpg">https://www.url.com/image.jpg</a>">'
>>> text = '<iframe src="https://www.url.com/image.jpg">'
>>> urlize(text)
u'<iframe src="<a href="https://www.url.com/image.jpg">https://www.url.com/image.jpg</a>">'

It didn't appeared in previous version (tested in 1.6)

Change History (1)

comment:1 by Tim Graham, 8 years ago

Component: Core (Other)Template system
Resolution: invalid
Status: newclosed
Type: UncategorizedBug

The documentation says, "If urlize is applied to text that already contains HTML markup, things won’t work as expected. Apply this filter only to plain text."

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