What is the problem?
Depending on what circumstances you open the "Insert link" dialog, you can see different validation logic being applied to input.
See reproduction scenarios below.
Steps to reproduce problem
One:
- In the wikieditor, type [:<>] or [{{fullurl:{{FULLPAGENAME}}|action=edit}} Edit this page]
- Highlight it
- Open the "Insert link" dialog
- See it considers it as invalid
- Click the radio button labelled "To a wiki page"
- Click the radio button labelled "To an external web page"
- See it is now considered valid
Expected behavior: Behaviour in steps 4 and 7 should be the same. Either at both times it should be considered invalid or at both times considered valid.
Observed behavior: In spite both steps 4 and 7 having the external radio button selected, the validation logic is not the same.
Two:
- In the wikieditor, type [[Foo%20bar]]
- Highlight it
- Open the "Insert link" dialog
- See it considers it as invalid
- Click the radio button labelled "To an external web page"
- Close the dialog
- With the text still highlighted, open the dialog again
- See it is now considered valid
Expected behavior: Behaviour in steps 4 and 8 should be the same.
Observed behavior: Steps 4 and 8 both have the internal link radio selected, but the validation is not the same.
Three:
- Open the "Insert link" dialog
- In the first input field, type https://en.wikipedia.beta.wmflabs.org/wiki/Foo%20bar
- Click the "Insert link" button
- In the popup that appears, click the "Internal link" button
Expected behavior: The input changes to "Foo%20bar" and is considered invalid. This is what happens normally when you enter "Foo%20bar" from scratch in the input.
Observed behavior: The input changes to "Foo%20bar" but is considered valid.
Environment
Browser: Firefox 91
Wiki(s): https://en.wikipedia.beta.wmflabs.org MediaWiki 1.38.0-alpha (82d4dab) 06:59, 21 February 2022.
Editor: WikiEditor 0.5.3 (3fa6f08) 07:13, 16 February 2022.