Kai Nissen (WMDE) has uploaded a new change for review.

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


Change subject: (bug 47653) Processing foreign API files protocol-relative
......................................................................

(bug 47653) Processing foreign API files protocol-relative

Bug: 47653

When a page contains resources being loaded by a foreign wiki's API, the
protocol type is being cached by the parser. When a user calls the
cached page afterwards, resources that have been originally loaded using
an unsecure protocol will always be loaded using an unsecure connection,
even if the user requests the page using a secure connection. Some
browsers warn the user about that.

The patch removes the protocol type from the retrieved 'thumburl',
leaving it protocol-relative.

Change-Id: Id40186d10019a77f8b827a6a67982d40f3e97f11
---
M includes/filerepo/ForeignAPIRepo.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/90/61390/1

diff --git a/includes/filerepo/ForeignAPIRepo.php 
b/includes/filerepo/ForeignAPIRepo.php
index 5cd6fc2..71129fa 100644
--- a/includes/filerepo/ForeignAPIRepo.php
+++ b/includes/filerepo/ForeignAPIRepo.php
@@ -236,7 +236,9 @@
                if ( $data && $info && isset( $info['thumburl'] ) ) {
                        wfDebug( __METHOD__ . " got remote thumb " . 
$info['thumburl'] . "\n" );
                        $result = $info;
-                       return $info['thumburl'];
+                       // replacing protocol type by protocol-relative '//'
+                       $thumbUrl = preg_replace( "/^(http\:|https\:)/i", "", 
$info['thumburl'] );
+                       return $thumbUrl;
                } else {
                        return false;
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id40186d10019a77f8b827a6a67982d40f3e97f11
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Kai Nissen (WMDE) <[email protected]>

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

Reply via email to