Skip to:
Content

bbPress.org

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
Cc:

Description

In the support forums, if you use this:

  • <a href="https://msdn.microsoft.com/en-us/library/ms530820(v=vs.85).aspx" target="_blank">https://msdn.microsoft.com/en-us/library/ms530820(v=vs.85).aspx</a>

It escapes to this:

  • <a href="https://msdn.microsoft.com/en-us/library/ms530820(v=vs.85).aspx" target="_blank" rel="nofollow"></a><a href="https://msdn.microsoft.com/en-us/library/ms530820(v=vs.85)" rel="nofollow">https://msdn.microsoft.com/en-us/library/ms530820(v=vs.85)</a>.aspx

Originall reported by @cybr in Slack #meta https://wordpress.slack.com/archives/C02QB8GMM/p1495374031432056


A standard WordPress post results in the correct formatting:

  • <a href="https://msdn.microsoft.com/en-us/library/ms530820(v=vs.85).aspx" target="_blank">https://msdn.microsoft.com/en-us/library/ms530820(v=vs.85).aspx</a>

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

  • <a href="https://msdn.microsoft.com/en-us/library/ms530820(v=vs.85).aspx" target="_blank" rel="nofollow"></a>
  • and
  • <a href="https://msdn.microsoft.com/en-us/library/ms530820(v=vs.85)" rel="nofollow">https://msdn.microsoft.com/en-us/library/ms530820(v=vs.85)</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.