jenkins-bot has submitted this change and it was merged.

Change subject: Take only the last part of a URL query in media search widget
......................................................................


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
---
M modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Alex Monk: Looks good to me, approved
  Esanders: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
index 0679b29..1c4a1c1 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 @@
  * @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;
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/315561
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I13e665226e5dc15ba626126dc4806ce8f4e0040b
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Tchanders <thalia.e.c...@googlemail.com>
Gerrit-Reviewer: Alex Monk <a...@wikimedia.org>
Gerrit-Reviewer: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to