[wp-trac] [WordPress Trac] #45702: make_clickable() doesn't handle linked text being a URL with spaces within it
WordPress Trac
noreply at wordpress.org
Fri Dec 21 02:31:44 UTC 2018
#45702: make_clickable() doesn't handle linked text being a URL with spaces within
it
------------------------------------------+------------------------------
Reporter: dd32 | Owner: (none)
Type: defect (bug) | Status: new
Priority: low | Milestone: Awaiting Review
Component: Formatting | Version:
Severity: trivial | Resolution:
Keywords: needs-unit-tests needs-patch | Focuses:
------------------------------------------+------------------------------
Comment (by dd32):
Just wanted to note this comment of mine from the bbPress ticket, as it
applies equally as well to WordPress's implementation (which has diverged
from what is used in bbPress it appears)
Just want to note that my proposed solution will break if there's a URL
''and'' HTML in the linked text, but that's even more edge-casey than the
reported problem:
{{{
<a href="https://testing/path/">http://testing/<strong>path</strong>/</a>
}}}
becomes
{{{
<a href="https://testing/path/"><a href="http://testing/"
rel="nofollow">http://testing/</a><strong>path</strong>/</a>
}}}
The regex in question isn't designed to prevent every case, just the most
obvious ones IMHO.
A better fix, could be to skip linking inside of `<a>` tags through the
same logic applied for `<script, style, code, and pre>` tags above it:
https://bbpress.trac.wordpress.org/browser/trunk/src/includes/common/formatting.php?rev=6885&marks=365-374#L344
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45702#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list