We have isValid() functions for similar inputs, but not this one, so it's possible to try to create a redirect to "|" (which Parsoid turns into MediaWiki:Badtitle).
Version: unspecified
Severity: normal
We have isValid() functions for similar inputs, but not this one, so it's possible to try to create a redirect to "|" (which Parsoid turns into MediaWiki:Badtitle).
Version: unspecified
Severity: normal
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | None | T73998 VisualEditor: “Uncaught Error: Unable to parse title” when entering "Talk:" as a template | |||
Resolved | None | T74468 VisualEditor: MWTitleInputWidget should return titles | |||
Resolved | None | T73249 VisualEditor: TitleInputWidget should validate inputs |
Currently the redirect section of the page settings dialog and the template placeholder page use MWTitleInputWidget.
The template placeholder page can be fixed with a simple change from value === '' to !mw.Title.newFromText( value ) in MWTemplatePlaceholderPage#onTemplateInputChange. It will no longer allow you to add a template with an invalid name. No need for isValid here.
As for the redirect settings, that seems more difficult. I don't think we should just silently ignore the value if it was set to an invalid title... And I don't think we should disable the apply button either.
(In reply to Alex Monk from comment #1)
Currently the redirect section of the page settings dialog and the template
placeholder page use MWTitleInputWidget.The template placeholder page can be fixed with a simple change from value
'' to !mw.Title.newFromText( value ) in
MWTemplatePlaceholderPage#onTemplateInputChange. It will no longer allow you
to add a template with an invalid name. No need for isValid here.
What happens when you use a parser function or a magic word?
As for the redirect settings, that seems more difficult. I don't think we
should just silently ignore the value if it was set to an invalid title...
And I don't think we should disable the apply button either.
We show "invalid title" for link searches; presumably that's evaluated server-side?
(In reply to James Forrester from comment #3)
(In reply to Alex Monk from comment #1)
Currently the redirect section of the page settings dialog and the template
placeholder page use MWTitleInputWidget.The template placeholder page can be fixed with a simple change from value
'' to !mw.Title.newFromText( value ) in
MWTemplatePlaceholderPage#onTemplateInputChange. It will no longer allow you
to add a template with an invalid name. No need for isValid here.What happens when you use a parser function or a magic word?
I imagine it would break. So let's not do that.
As for the redirect settings, that seems more difficult. I don't think we
should just silently ignore the value if it was set to an invalid title...
And I don't think we should disable the apply button either.We show "invalid title" for link searches; presumably that's evaluated
server-side?
That is shown when the page does not seem to exist (based on the search results) and we get a false-y value from mw.Title.newFromText on the given title.
This is scarily close to what I filed bug 72468 about. While filing it I was thinking that an isValid() implementation should also be provided. I'll add that to that bug.
Change 169623 had a related patch set uploaded by SuchetaG:
Introducing isValid() in MWTitileInputWidget
test2 has the same validation that is in betalabs:
(In reply to etonkovidova from comment #8)
test2 has the same validation that is in betalabs:
- cannot add Talk: as a template - 'Add template' is disabled
- cannot add a template or a category with |(a pipe), < and > chars
- if 'Page settings' redirection has aforementioned symbols -
MediaWiki:Badtitletext is displayed. Does it need some improvement?
That sounds like it covers all our needs.