Normalize user provided URL link for Special:LinkSearch page
authorRamunas Geciauskas <ramunas@geciauskas.com>
Tue, 8 Mar 2016 20:31:55 +0000 (15:31 -0500)
committerRamunas Geciauskas <ramunas@geciauskas.com>
Tue, 8 Mar 2016 20:36:28 +0000 (15:36 -0500)
Using Parser::normalizeLinkUrl() to normalize links before passing them to
the Special:LinkSearch handler allows us to avoid URL encoding issues when
searching for URL with special/escaped characters.
E.g. As listed in T126913 currently user needs to provide URL exactly as it
is stored in MediaWiki (' vs %27) in order to find it.
Normalizing URL will allow searching in Special:LinkSearch page using both
direct and encoded characters (since it will get normalized to the uniform
format).

Bug: T126913
Change-Id: If17b1896a3f40ba99c78fccb9f69100b2a0f5cba

includes/specials/SpecialLinkSearch.php

index bc33b8e..2a7046e 100644 (file)
@@ -158,7 +158,7 @@ class LinkSearchPage extends QueryPage {
 
                if ( $target != '' ) {
                        $this->setParams( [
-                               'query' => $target2,
+                               'query' => Parser::normalizeLinkUrl( $target2 ),
                                'namespace' => $namespace,
                                'protocol' => $protocol ] );
                        parent::execute( $par );