MWLinkTargetInputWidget: Check title is valid in MediaWiki

Bug: T86709
Change-Id: Ia399d3e8847d520b5d57baa302de8197fdea0787
This commit is contained in:
Alex Monk 2015-01-16 02:30:52 +00:00 committed by Jforrester
parent 1a4c821dad
commit 1e8929993d

View file

@ -90,7 +90,7 @@ ve.ui.MWLinkTargetInputWidget.prototype.isValid = function () {
valid = this.annotation.getAttribute( 'href' ) valid = this.annotation.getAttribute( 'href' )
.match( /(^|\s)((https?:\/\/)?[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?)/gi ); .match( /(^|\s)((https?:\/\/)?[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?)/gi );
} else { } else {
valid = !!this.getValue(); valid = !!mw.Title.newFromText( this.getValue() );
} }
return $.Deferred().resolve( valid ).promise(); return $.Deferred().resolve( valid ).promise();
}; };