Skip to:

Opened 7 years ago

Last modified 7 years ago

#3107 new defect (bug)

Parenthesis `(` / `)` in URLs causes unintended duplicate links

Reported by: netweb's profile netweb Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: Future Release Priority: normal
Severity: normal Version: 2.0
Component: API - Formatting Keywords: needs-patch needs-unit-tests


In the support forums, if you use this:

  • <a href="" target="_blank"></a>

It escapes to this:

  • <a href="" target="_blank" rel="nofollow"></a><a href="" rel="nofollow"></a>.aspx

Originall reported by @cybr in Slack #meta

A standard WordPress post results in the correct formatting:

  • <a href="" target="_blank"></a>

When looking closer bbPress in fact is turning it into two links:

  • <a href="" target="_blank" rel="nofollow"></a>
  • and
  • <a href="" rel="nofollow"></a>.aspx

I suspect the parenthesis might be getting tripped up in bbp_make_clickable()

Change History (3)

This ticket was mentioned in Slack in #meta by netweb. View the logs.

7 years ago

#2 @johnjamesjacoby
7 years ago

  • Keywords good-first-bug removed
  • Milestone changed from Future Release to 2.6
  • Owner set to johnjamesjacoby
  • Version set to 2.0

WordPress uses make_clickable() in comments, and exhibits the same problem.

This will be tricky, because parenthesis are used to roll/unroll the crazy-fun regular expression.

I'll look at it here, but it'll require an upstream patch to WordPress, too.

#3 @johnjamesjacoby
7 years ago

  • Milestone changed from 2.6 to Future Release

The bug happens because of assumptions regarding what a URL with parenthesis looks like:

  • Must have matching pairs of ( and ) which seems sane, but might not be part of any official spec
  • Must not have trailing text after the final parenthesis pair (like .html in this case)

The second assumption is part of #WP14993, likely thanks to how many Wikipedia URLs are structured.

I'm going to punt this to Future Release here because this will require an upstream change to _make_url_clickable_cb() which bbPress does still use, even though it has its own bbp_make_clickable function & filter pair.

Note: See TracTickets for help on using tickets.