Take only the last part of a URL query in media search widget

Quick fix to the problem that searching for the file name or
page title currently returns the image, but searching for the
URL does not.

Bug: T121354
Change-Id: I13e665226e5dc15ba626126dc4806ce8f4e0040b
This commit is contained in:
Thalia 2016-10-12 12:55:17 -07:00 committed by Alex Monk
parent 9939a68db2
commit 7ec7acf108

View file

@ -199,7 +199,12 @@ ve.ui.MWMediaSearchWidget.prototype.processQueueResults = function ( items ) {
* @return {string} Query value * @return {string} Query value
*/ */
ve.ui.MWMediaSearchWidget.prototype.getQueryValue = function () { ve.ui.MWMediaSearchWidget.prototype.getQueryValue = function () {
return this.query.getValue().trim(); var queryValue = this.query.getValue().trim();
if ( queryValue.match( ve.init.platform.getExternalLinkUrlProtocolsRegExp() ) ) {
queryValue = queryValue.match( /.+\/([^\/]+)/ )[ 1 ];
}
return queryValue;
}; };
/** /**