Skip bad suggestedvalues and aliases in the template dialog

Bug: T297386
Change-Id: I6456d720c923e8cff9b4500b6cfe52bc6fbc9dad
This commit is contained in:
Thiemo Kreuz 2021-12-09 14:16:02 +01:00 committed by Thiemo Kreuz (WMDE)
parent 887a01a355
commit 66636e1dd8
2 changed files with 6 additions and 2 deletions

View file

@ -338,7 +338,10 @@ ve.ui.MWParameterPage.prototype.createValueInput = function () {
) {
valueInputConfig.menu = { filterFromInput: true, highlightOnFilter: true };
valueInputConfig.options =
this.parameter.getSuggestedValues().map( function ( suggestedValue ) {
this.parameter.getSuggestedValues().filter( function ( suggestedValue ) {
// This wasn't validated for a while, existing templates can do anything here
return typeof suggestedValue === 'string';
} ).map( function ( suggestedValue ) {
return { data: suggestedValue };
} );
this.rawValueInput = true;

View file

@ -256,7 +256,8 @@ ve.ui.MWTransclusionOutlineTemplateWidget.prototype.filterParameters = function
].concat( spec.getParameterAliases( paramName ) );
var foundSomeMatch = placesToSearch.some( function ( term ) {
return term && term.toLowerCase().indexOf( query ) !== -1;
// Aliases missed validation for a long time and aren't guaranteed to be strings
return term && typeof term === 'string' && term.toLowerCase().indexOf( query ) !== -1;
} );
item.toggle( foundSomeMatch );