Subramanya Sastry has uploaded a new change for review.

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

Change subject: T110692: Massage batching API imageinfo width/height to numbers
......................................................................

T110692: Massage batching API imageinfo width/height to numbers

Change-Id: I6a0b9d2a0c5bd52ac74b64370dad8f85c4fcd76b
---
M lib/ext.core.LinkHandler.js
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/14/234714/1

diff --git a/lib/ext.core.LinkHandler.js b/lib/ext.core.LinkHandler.js
index 61e1e84..cbbded5 100644
--- a/lib/ext.core.LinkHandler.js
+++ b/lib/ext.core.LinkHandler.js
@@ -1011,6 +1011,11 @@
                }
        }
 
+       // T110692: The batching API seems to return these as strings.
+       // Till that is fixed, let us make sure these are numbers.
+       info.height = Number(info.height);
+       info.width = Number(info.width);
+
        var imageSrc = dataAttribs.src;
        if (!dataAttribs.uneditable) {
                dataAttribs.src = undefined;
@@ -1068,6 +1073,7 @@
                        size.width = Math.round(info.width * ratio);
                }
        }
+
        if (size.height) {
                img.addNormalizedAttribute('height', size.height.toString());
        }
@@ -1075,7 +1081,6 @@
        if (size.width) {
                img.addNormalizedAttribute('width', size.width.toString());
        }
-
        // If the format is something we *recognize*, add the subtype
        switch (format) {
                case 'thumbnail':

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a0b9d2a0c5bd52ac74b64370dad8f85c4fcd76b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org>

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

Reply via email to