Page MenuHomePhabricator

VisualEditor: Non-'bitcoin:' external links with single brackets around it should be indicated as invalid external link inside link inspector
Closed, ResolvedPublic

Description

Screenshot

Steps to reproduce:

1.Open a page with VE
2.Open the link inspector : insert [http://yahoo.com]
3.Apply the link
4.Save the page

Observed Result:
The link appears inside VE with single brackets around it: [http://yahoo.com]
And when you save the page, the unicode for the ending single bracket appears at the end of the link as a part of that link:[http://yahoo.com]

Expected Result:
The link inspector should say to user that it is an invalid external link format.


Version: unspecified
Severity: normal

Attached:

Screen_Shot_2014-05-20_at_12.06.32_PM.png (289×850 px, 25 KB)

Details

Reference
bz65547

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:08 AM
bzimport set Reference to bz65547.

note that the wikitext for the saved string reads:

&#x5Dhttp://yahoo.com]

Is our regex not anchored to the start of the string somehow?

Currently, the regex looks something like this (based on wgUrlProtocols):

/^bitcoin\:|ftp\:\/\/|ftps\:\/\/|geo\:|git\:\/\/|gopher\:\/\/|http\:\/\/|https\:\/\/|irc\:\/\/|ircs\:\/\/|magnet\:|mailto\:|mms\:\/\/|news\:|nntp\:\/\/|redis\:\/\/|sftp\:\/\/|sip\:|sips\:|sms\:|ssh\:\/\/|svn\:\/\/|tel\:|telnet\:\/\/|urn\:|worldwind\:\/\/|xmpp\:|\/\//

Notice the '^' is only against 'bitcoin' and not any other protocol? Yeah I think we need to wrap everything after the '^' in brackets.

Change 139128 had a related patch set uploaded by Alex Monk:
Wrap external URL protocols regex in brackets.

https://gerrit.wikimedia.org/r/139128

Do we need to upstream a fix for wgUrlProtocols?

I don't think so. I think things including the wgUrlProtocols regex should be dealing with this issue themselves.

Change 139128 merged by jenkins-bot:
Wrap external URL protocols regex in brackets.

https://gerrit.wikimedia.org/r/139128