[MediaWiki-commits] [Gerrit] (bug 43015) Make Parsoid use protocol relative URLs for imag... - change (mediawiki...Parsoid)

2013-06-24 Thread Inez (Code Review)
Inez has uploaded a new change for review.

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


Change subject: (bug 43015) Make Parsoid use protocol relative URLs for images 
(http vs. https)
..

(bug 43015) Make Parsoid use protocol relative URLs for images (http vs. https)

Change-Id: I253b9b7a9b463439e86d7cf7975cd92f9c851e70
---
M js/lib/ext.core.LinkHandler.js
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/44/70344/1

diff --git a/js/lib/ext.core.LinkHandler.js b/js/lib/ext.core.LinkHandler.js
index ff83dda..f2f7130 100644
--- a/js/lib/ext.core.LinkHandler.js
+++ b/js/lib/ext.core.LinkHandler.js
@@ -598,11 +598,13 @@
  * @param {string} info.url The base URL for the image
  */
 function getPath( path, info ) {
+   var path;
if ( info.thumburl ) {
-   return info.thumburl;
+   path = info.thumburl;
} else if ( info.url ) {
-   return info.url;
+   path = info.url;
}
+   return path.replace(/^https?:\/\//, '//');
 }
 
 // It turns out that image captions can have unclosed block tags which

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I253b9b7a9b463439e86d7cf7975cd92f9c851e70
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Inez i...@wikia-inc.com

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


[MediaWiki-commits] [Gerrit] (bug 43015) Make Parsoid use protocol relative URLs for imag... - change (mediawiki...Parsoid)

2013-06-24 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: (bug 43015) Make Parsoid use protocol relative URLs for images 
(http vs. https)
..


(bug 43015) Make Parsoid use protocol relative URLs for images (http vs. https)

gwicke: Also update parserTests.txt from core.

Change-Id: I253b9b7a9b463439e86d7cf7975cd92f9c851e70
---
M js/lib/ext.core.LinkHandler.js
M js/tests/fetch-parserTests.txt.js
M js/tests/parserTests.txt
3 files changed, 19 insertions(+), 18 deletions(-)

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



diff --git a/js/lib/ext.core.LinkHandler.js b/js/lib/ext.core.LinkHandler.js
index ff83dda..5a91fd0 100644
--- a/js/lib/ext.core.LinkHandler.js
+++ b/js/lib/ext.core.LinkHandler.js
@@ -592,17 +592,18 @@
  * Abstract way to get the path for an image given an info object
  *
  * @private
- * @param {string} path Your best guess for the path
  * @param {Object} info
  * @param {string/null} info.thumburl The URL for a thumbnail
  * @param {string} info.url The base URL for the image
  */
-function getPath( path, info ) {
+function getPath( info ) {
+   var path;
if ( info.thumburl ) {
-   return info.thumburl;
+   path = info.thumburl;
} else if ( info.url ) {
-   return info.url;
+   path = info.url;
}
+   return path.replace(/^https?:\/\//, '//');
 }
 
 // It turns out that image captions can have unclosed block tags which
@@ -886,7 +887,7 @@
// Update some already-defined nonsense based on response
height = dims.h;
width = dims.w;
-   path = getPath( path, info );
+   path = getPath( info );
 
if ( oHash.alt ) {
img.addNormalizedAttribute( 'alt', oHash.alt, altBackup 
);
diff --git a/js/tests/fetch-parserTests.txt.js 
b/js/tests/fetch-parserTests.txt.js
index be469ec..98763cb 100755
--- a/js/tests/fetch-parserTests.txt.js
+++ b/js/tests/fetch-parserTests.txt.js
@@ -10,9 +10,9 @@
 // and update these hashes automatically.
 //
 // You can use 'sha1sum -b tests/parser/parserTests.txt' to compute this value:
-var expectedSHA1 = 6dece70c05306b6b43cebba77ea3bd3d5d174686;
+var expectedSHA1 = 06f0168ac46884820e45c27f0d33b1c948127561;
 // git log --pretty=oneline -1 tests/parser/parserTests.txt
-var latestCommit = 11b306fe5fd7d9d75731d37d069612bb6a3d9968;
+var latestCommit = e92342be637fd8663c08521a814f820d3f901c37;
 
 var fs = require('fs'),
path = require('path'),
diff --git a/js/tests/parserTests.txt b/js/tests/parserTests.txt
index e03ac58..b720ab2 100644
--- a/js/tests/parserTests.txt
+++ b/js/tests/parserTests.txt
@@ -8043,7 +8043,7 @@
 p
 span class=mw-default-size typeof=mw:Image
 a href=File:Foobar.jpg
-img resource=./File:Foobar.jpg 
src=http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg; 
height=220 width=1941
+img resource=./File:Foobar.jpg 
src=//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg height=220 
width=1941
 /a
 /span
 /p
@@ -8059,7 +8059,7 @@
 p
 span class=mw-default-size typeof=mw:Image
 span
-img resource=./File:Foobar.jpg 
src=http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg; 
height=220 width=1941
+img resource=./File:Foobar.jpg 
src=//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg height=220 
width=1941
 /span
 /span
 /p
@@ -8075,7 +8075,7 @@
 p
 span class=mw-default-size typeof=mw:Image
 a href=Main_Page
-img resource=./File:Foobar.jpg 
src=http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg; 
height=220 width=1941
+img resource=./File:Foobar.jpg 
src=//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg height=220 
width=1941
 /a
 /span
 /p
@@ -8091,7 +8091,7 @@
 p
 span class=mw-valign-middle typeof=mw:Image
 a href=File:Foobar.jpg
-img resource=./File:Foobar.jpg 
src=http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg;
 height=6 width=50
+img resource=./File:Foobar.jpg 
src=//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg 
height=6 width=50
 /a
 /span
 /p
@@ -8107,7 +8107,7 @@
 p
 span class=mw-valign-baseline typeof=mw:Image 
data-mw={quot;captionquot;:quot;captionquot;}
 a href=File:Foobar.jpg
-img resource=./File:Foobar.jpg 
src=http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg;
 height=10 width=89
+img resource=./File:Foobar.jpg 
src=//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg 
height=10 width=89
 /a
 /span
 /p
@@ -8123,7 +8123,7 @@
 p
 span class=mw-image-border typeof=mw:Image 
data-mw={quot;captionquot;:quot;captionquot;}
 a href=File:Foobar.jpg
-img resource=./File:Foobar.jpg 
src=http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg;
 height=6 width=50
+img resource=./File:Foobar.jpg 
src=//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg