Make WordPress Core

Opened 7 years ago

Last modified 4 months ago

#37758 new defect (bug)

The Link Checker tool does not detect some links

Reported by: djibs13's profile Djibs13 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.6
Component: Editor Keywords: good-first-bug has-patch
Focuses: administration Cc:



The Link Checker tool in WordPress 4.6 doesn’t detect an error when you put something before ‘http(s)‘. Example: x

And the tool does not detect error if a missing letter in "http".
examples :

Attachments (1)

DJIBS 2016-08-21 à 16.16.31.jpg (47.6 KB) - added by Djibs13 7 years ago.

Download all attachments as: .zip

Change History (9)

#1 @Presskopp
7 years ago

Confirmed. You can enter most kinds of stupidity and it will not fire.

Related: #36638, code to find in [38159]


#2 @Presskopp
7 years ago

  • Keywords needs-patch added

#3 @azaozz
7 years ago

Right. In order to not flag all the various URI schemes, it only checks links that start with http. Note that there is another small piece of regex in both link dialogs that prepends http:// to URIs that do not look like local.

On the other hand this can be changed to trigger on anything other than /^(https?|ftp|mailto):|^\//i as these uncommon schemes are probably used very very rarely.

#5 @noisysocks
3 years ago

  • Keywords good-first-bug added

This ticket was mentioned in PR #2308 on WordPress/wordpress-develop by aleksganev.

16 months ago

  • Keywords has-patch added; needs-patch removed

Fixes to the link validation in the TinyMCE editor.

The Link Checker tool in did not correctly validate the Protocol in the links, allowing anything to be written before the ":" part of the link without displaying it as invalid (e.g. _qwerty://

The validation should now mark as invalid anything that is not a _http(s):_, _mailto:_ or _ftp://_ link.

Trac ticket:

#7 @aleksganev
16 months ago

Hey guys, this is my first patch, so I hope I did everything correctly.

I used @azaozz's suggestion and made the validation mark as invalid everything except http(s), mailto and ftp links. I reused the email check which was already in the file, added a new test that checks for "ftp:" in the beginning of the link and modified the link check, so that it allows only valid http and https urls. If all 3 of the tests fail, the string will be marked as invalid.

Last edited 16 months ago by aleksganev (previous) (diff)

@aleks7391 commented on PR #2308:

4 months ago

PR Looks fine.
the line -
if ( ! isLink && ! isEmail && ! isFtp )

is more readable if written this way

if ( ! ( isLink || isEmail || isFtp ) )

@atiqsu Updated that line as suggested. Please take another look.
Commit - 2ae8cf8

Note: See TracTickets for help on using tickets.