From 70694b2bbf7cd5728e43aaf28ea4af88548c12f1 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 22 May 2013 00:20:41 +0200 Subject: [PATCH] MWLinkTargetInputWidget: Normalise value before matching Don't suggest a "new page" (redlink) for values that are strictly different but the same as a suggestion according to mw.Title (e.g. input "foo" with an existing "Foo" page should not suggest a redlink to inexistant page "foo"). Bug: 48476 Change-Id: I66f5fc56554984af58d6223dc6cd76b3ab9940bd --- modules/ve/ui/widgets/ve.ui.MWLinkTargetInputWidget.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/ve/ui/widgets/ve.ui.MWLinkTargetInputWidget.js b/modules/ve/ui/widgets/ve.ui.MWLinkTargetInputWidget.js index b427020d4d..1df82f4b60 100644 --- a/modules/ve/ui/widgets/ve.ui.MWLinkTargetInputWidget.js +++ b/modules/ve/ui/widgets/ve.ui.MWLinkTargetInputWidget.js @@ -115,7 +115,11 @@ ve.ui.MWLinkTargetInputWidget.prototype.getLookupMenuItemsFromData = function ( } // Internal link - if ( !pageExists && ( !matchingPages || matchingPages.indexOf( this.value ) === -1 ) ) { + if ( !pageExists && ( !matchingPages || + // Run value through mw.Title to avoid treating a match as a mismatch where + // normalisation would make them matching (bug 48476) + matchingPages.indexOf( new mw.Title( this.value ).toString() ) === -1 + ) ) { items.push( new ve.ui.MenuSectionItemWidget( 'newPage', { '$$': menu$$, 'label': ve.msg( 'visualeditor-linkinspector-suggest-new-page' ) }