John Erling Blad has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/51956


Change subject: (Bug 45223) URL-escape title before it is used in URL
......................................................................

(Bug 45223) URL-escape title before it is used in URL

Change-Id: I2c5dcb997157b36fda6547714b12be7dfa6b4712
---
M client/WikibaseClient.hooks.php
1 file changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/56/51956/1

diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index fbe0d19..93058f2 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -377,7 +377,7 @@
                );
 
                if ( $itemId !== false ) {
-                       $itemByTitle = 'Special:ItemByTitle/' . $globalId . '/' 
. $oldTitle->getDBkey();
+                       $itemByTitle = 'Special:ItemByTitle/' . $globalId . '/' 
. wfUrlencode( $oldTitle->getDBkey() );
                        $itemByTitleLink = ClientUtils::repoArticleUrl( 
$itemByTitle );
                        $out = $movePage->getOutput();
                        $out->addModules( 'wikibase.client.page-move' );
@@ -597,12 +597,6 @@
                $title = $skin->getContext()->getTitle();
                if ( in_array( $title->getNamespace(), Settings::get( 
'namespaces' ) ) && $title->exists() ) {
 
-                       $title = $skin->getContext()->getTitle();
-
-                       // gets the main part of the title, no underscores used 
in this db table
-                       $titleText = $title->getPrefixedText();
-                       $siteId = Settings::get( 'siteGlobalID' );
-
                        if ( empty( $template->data['language_urls'] ) && 
\Action::getActionName( $skin->getContext() ) === 'view' ) {
                                // Placeholder in case the page doesn't have 
any langlinks yet
                                // self::onBeforePageDisplay adds the 
JavaScript module which will overwrite this with a link
@@ -616,12 +610,18 @@
                                return true;
                        }
 
+                       $title = $skin->getContext()->getTitle();
+
+                       // gets the main part of the title, no underscores used 
in this db table
+                       $titleText = $title->getPrefixedText();
+                       $siteId = Settings::get( 'siteGlobalID' );
+
                        $itemId = 
ClientStoreFactory::getStore()->newSiteLinkTable()->getItemIdForLink( $siteId, 
$titleText );
 
                        if ( $itemId ) {
                                // links to the special page
                                $template->data['language_urls'][] = array(
-                                       'href' => ClientUtils::repoArticleUrl( 
"Special:ItemByTitle/$siteId/$titleText" ),
+                                       'href' => ClientUtils::repoArticleUrl( 
"Special:ItemByTitle/$siteId/" . wfUrlencode( $titleText ) ),
                                        'text' => wfMessage( 
'wikibase-editlinks' )->text(),
                                        'title' => wfMessage( 
'wikibase-editlinkstitle' )->text(),
                                        'class' => 'wbc-editpage',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c5dcb997157b36fda6547714b12be7dfa6b4712
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: John Erling Blad <john.b...@wikimedia.de>

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

Reply via email to