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

Change subject: LinkSearch: use default protocol if unsupported
......................................................................


LinkSearch: use default protocol if unsupported

Default $protocol to http:// if part of link up to
colon or double-slash isn't in $wgUrlProtocols.

Also simplify elseif condition above - $protocol is
always blank there since neither if block above it
is executed.

Bug: 33029
Change-Id: I66d2c592998c750fe3da937b228fe1387fcd344c
---
M includes/specials/SpecialLinkSearch.php
1 file changed, 6 insertions(+), 3 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialLinkSearch.php 
b/includes/specials/SpecialLinkSearch.php
index 5b0c56e..ed6e2a4 100644
--- a/includes/specials/SpecialLinkSearch.php
+++ b/includes/specials/SpecialLinkSearch.php
@@ -73,14 +73,17 @@
                        // For protocols without '//' like 'mailto:'
                        $protocol = substr( $target2, 0, $pr_cl + 1 );
                        $target2 = substr( $target2, $pr_cl + 1 );
-               } elseif ( $protocol == '' && $target2 != '' ) {
+               } elseif ( $target2 != '' ) {
                        // default
                        $protocol = 'http://';
                }
                if ( $protocol != '' && !in_array( $protocol, $protocols_list ) 
) {
-                       // unsupported protocol, show original search request
+                       // Unsupported protocol, show original search request
                        $target2 = $target;
-                       $protocol = '';
+                       // Since links with unsupported protocols don't end up 
in
+                       // externallinks, assume $protocol is actually part of 
a link
+                       // containing ':' or '//' and default to http as above.
+                       $protocol = 'http://';
                }
 
                $out->addWikiMsg(

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I66d2c592998c750fe3da937b228fe1387fcd344c
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to