Opened 6 years ago

Closed 4 years ago

#12183 closed Bug (fixed)

urlize doesn't always add rel=nofollow

Reported by: eronen Owned by: nobody
Component: Template system Version: 1.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


If the text passed to "urlize" template filter or django.utils.html.urlize contains multiple URLs,
and one of them is a mailto: URL, then the URLs after the mailto URL will not have rel=nofollow even
when you called urlize with nofollow=True.

Fix: Move the line "nofollow_attr = nofollow and ' rel="nofollow"' or " inside the
for loop (one line downwards)

Change History (6)

comment:1 Changed 6 years ago by russellm

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

comment:2 Changed 6 years ago by morty

  • Needs tests unset

I have attached joint test and fix patches for this bug to ticket #119911. I won't upload them again here.

comment:3 Changed 6 years ago by morty

Sorry that should have been ticket #11911.

comment:4 Changed 5 years ago by mattmcc

  • Severity set to Normal
  • Type set to Bug

comment:5 Changed 5 years ago by anonymous

  • Easy pickings unset
  • Has patch unset
  • UI/UX unset

the patch for #11911 has been properly factored, a patch for this issue needs to be specifically attached

comment:6 Changed 4 years ago by aaugustin

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

In [17356]:

Fixed #12183 -- Made the urlize filter insert the nofollow attribute properly when an http: URL occurs after a mailto: URL. Thanks eronen for the report.

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