Page MenuHomePhabricator

"Insert link" incorrectly handling of certain protocols and syntax
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

The "Insert link" dialog does not treat some input/protocols correctly, leading it to insert incorrect links.

  1. It inserts //en.wikipedia.org as [http:////en.wikipedia.org //en.wikipedia.org]
  2. It inserts mailto:info@example.org as [http://mailto:info@example.org mailto:info@example.org]
  3. If you highlight [{{fullurl:{{FULLPAGENAME}}|action=edit}} Edit this page] and open the dialog, when you insert it converts it to [http://{{fullurl:{{FULLPAGENAME}}|action=edit}} Edit this page] (which is an invalid link)

Both are examples of supported link syntax which is listed in our documentation: https://www.mediawiki.org/wiki/Help:Links

Steps to reproduce problem
  1. Edit an article
  2. Open the "Insert link" dialog
  3. In the first field, type //en.wikipedia.org or mailto:info@example.org and submit

Expected behavior: It inserts links as per https://www.mediawiki.org/wiki/Help:Links
Observed behavior: The links it inserts are not correct for the protocol.

Environment

Operating system:
Browser:
Wiki(s): https://en.wikipedia.beta.wmflabs.org MediaWiki 1.38.0-alpha (e1fa59d) 15:08, 18 February 2022.
Editor: WikiEditor 0.5.3 (3fa6f08) 07:13, 16 February 2022.

Event Timeline

Change #1216224 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/WikiEditor@master] dialogs: fix protocol regexp for external links

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

Change #1216224 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] dialogs: fix protocol regexp for external links

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