Page MenuHomePhabricator

Dialog allows to insert invalid urls
Open, MediumPublic

Description

Steps to reproduce:

  1. Open a page for editing, chose the insert link dialog.
  2. Enter "a a" as url
  3. Chose "To an external web page" (If you ask why someone should do this, I can only say that I don't know, but that I've seen too many of these links to ignore them)
  4. Click "Insert Link"

Result: [http://a%20a a a] is inserted.
Expected result: The insert link button should be grayed out when the link to be inserted is definitely invalid.


Version: unspecified
Severity: normal

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:32 PM
bzimport added a project: WikiEditor.
bzimport set Reference to bz28789.
bzimport added a subscriber: Unknown Object (MLST).

Change 141367 had a related patch set uploaded by TheDJ:
Link dialog: do basic URI validation

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

Change 141367 abandoned by TheDJ:
Link dialog: do basic URI validation

Reason:
No reviewers willing to review

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

Change 141367 had a related patch set uploaded (by Paladox):
Link dialog: do basic URI validation

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

Change 552359 had a related patch set uploaded (by Happy5214; owner: Happy5214):
[mediawiki/extensions/WikiEditor@master] Link dialog: do basic URI validation

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

Change 141367 abandoned by Aklapper:

[mediawiki/extensions/WikiEditor@master] Link dialog: do basic URI validation

Reason:

Superseded by https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiEditor/+/552359

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

Appears to have been fixed in 6384498d as part of the OOUI conversion of the link insertion dialog.

Edit: It appears the code to fix this was added in that commit, but the example listed in the original bug report still fails.

Change 552359 abandoned by Happy5214:

[mediawiki/extensions/WikiEditor@master] Link dialog: do basic URI validation

Reason:

Obsolete in light of OOUI rewrite of dialog.

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

happy5214 subscribed.

Notes for testing:

  1. The validation logic will be different for an external link compared to an internal link. Test that the validation logic is still correct when you switching between internal and external in the dialog (and you should do this several times in a loop).
  2. Test the validation logic is correct when you highlight some wikitext and open the dialog (which will pre-populate the dialog). For example, at the moment, if I highlight [:<>] and open the dialog it is considered invalid. But, if I open the dialog without highlighting anything, switch to external and type :<> it is considered valid.