Code

Opened 2 years ago

Closed 2 years ago

#18071 closed Bug (fixed)

urlize is case-sensitive

Reported by: luke@… Owned by: nobody
Component: Uncategorized Version: 1.4
Severity: Normal Keywords: urlize
Cc: adamzap@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

When you run urlize() on url schemes that have been uppercased, urlize fails to convert them to clickable links.

>>> from django.utils.html import urlize
>>> urlize("foo http://bar.com https://baz.com HTTPS://bar.com")
u'foo <a href="http://bar.com">http://bar.com</a> <a href="https://baz.com">https://baz.com</a> HTTPS://bar.com'

Expected output:

>>> from django.utils.html import urlize
>>> urlize("foo http://bar.com https://baz.com HTTPS://bar.com")
u'foo <a href="http://bar.com">http://bar.com</a> <a href="https://baz.com">https://baz.com</a> <a href="https://bar.com">HTTPS://bar.com</a>'

Attachments (2)

urlize.patch (942 bytes) - added by luke@… 2 years ago.
patch to make url regex case insensitive
18071-regression-test.diff (704 bytes) - added by adamzap 2 years ago.
Test for uppercase URL schemes with urlize

Download all attachments as: .zip

Change History (5)

Changed 2 years ago by luke@…

patch to make url regex case insensitive

comment:1 Changed 2 years ago by claudep

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 2 years ago by adamzap

Test for uppercase URL schemes with urlize

comment:2 Changed 2 years ago by adamzap

  • Cc adamzap@… added
  • Needs tests unset

comment:3 Changed 2 years ago by claudep

  • Resolution set to fixed
  • Status changed from new to closed

In [17898]:

Fixed #18071 -- Ignored case sensitivity in urlize utility. Thanks luke@… and adamzap for the report and the patch.

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.