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

Change subject: (Bug 47732) Chrome blocks API calls to foreign Wikipedia APIs 
due to insecure protocol
......................................................................


(Bug 47732) Chrome blocks API calls to foreign Wikipedia APIs due to insecure 
protocol

Protocol-relative URLs.

Change-Id: I8d13025726300f367e054f3ace52c945003d80c4
---
M lib/includes/modules/SitesModule.php
1 file changed, 13 insertions(+), 3 deletions(-)

Approvals:
  Tobias Gritschacher: Looks good to me, but someone else must approve
  Hoo man: Verified; Looks good to me, but someone else must approve
  Aude: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/includes/modules/SitesModule.php 
b/lib/includes/modules/SitesModule.php
index 4f2f713..50d54a9 100644
--- a/lib/includes/modules/SitesModule.php
+++ b/lib/includes/modules/SitesModule.php
@@ -54,12 +54,22 @@
                        if ( $site->getType() === Site::TYPE_MEDIAWIKI && 
$site->getGroup() === 'wikipedia' ) {
                                $languageName = Utils::fetchLanguageName( 
$site->getLanguageCode() );
 
+                               // Use protocol relative URIs, as it's safe to 
assume that all wikis support the same protocol
+                               list( $pageUrl, $apiUrl ) = preg_replace(
+                                       "/^https?:/i",
+                                       '',
+                                       array(
+                                               $site->getPageUrl(),
+                                               $site->getFileUrl( 'api.php' )
+                                       )
+                               );
+
                                $sites[$site->getLanguageCode()] = array(
                                        'shortName' => $languageName,
                                        'name' => $languageName,
                                        'globalSiteId' => $site->getGlobalId(),
-                                       'pageUrl' => $site->getPageUrl(),
-                                       'apiUrl' => $site->getFileUrl( 
'api.php' ),
+                                       'pageUrl' => $pageUrl,
+                                       'apiUrl' => $apiUrl,
                                        'languageCode' => 
$site->getLanguageCode()
                                );
                        }
@@ -67,4 +77,4 @@
 
                return 'mediaWiki.config.set( "wbSiteDetails", ' . 
\FormatJson::encode( $sites ) . ' );';
        }
-}
\ No newline at end of file
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8d13025726300f367e054f3ace52c945003d80c4
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Wizardist <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Lydia Pintscher <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: Wizardist <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to