From 7ec7acf108613b6df9a1c89ec16bf184b75085ef Mon Sep 17 00:00:00 2001 From: Thalia Date: Wed, 12 Oct 2016 12:55:17 -0700 Subject: [PATCH] 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 --- modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js index 0679b291e9..1c4a1c1578 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js @@ -199,7 +199,12 @@ ve.ui.MWMediaSearchWidget.prototype.processQueueResults = function ( items ) { * @return {string} Query value */ 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; }; /**