Arlolra has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/327125 )
Change subject: [linter] Fix crasher when linting a gallery ...................................................................... [linter] Fix crasher when linting a gallery Bug: T152785 Change-Id: Icb6d2062467262b087d0931e86880cb51abe6d91 --- M lib/wt2html/pp/handlers/linter.js M tests/mocha/linter.js 2 files changed, 10 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/25/327125/1 diff --git a/lib/wt2html/pp/handlers/linter.js b/lib/wt2html/pp/handlers/linter.js index ef21744..d7ca19a 100644 --- a/lib/wt2html/pp/handlers/linter.js +++ b/lib/wt2html/pp/handlers/linter.js @@ -244,7 +244,7 @@ * See - https://www.mediawiki.org/wiki/Help:Images#Syntax */ function logBogusImageOptions(env, c, dp, tplInfo) { - if (DU.isGeneratedFigure(c)) { + if (DU.isGeneratedFigure(c) && dp.optList) { var items = []; dp.optList.forEach(function(item) { if (item.ck === "bogus") { diff --git a/tests/mocha/linter.js b/tests/mocha/linter.js index 6018b6f..ed9bc44 100644 --- a/tests/mocha/linter.js +++ b/tests/mocha/linter.js @@ -1,9 +1,10 @@ /** Test cases for the linter */ 'use strict'; -require('../../core-upgrade.js'); /*global describe, it*/ -var should = require("chai").should(); /*jshint unused:false*/ +require('../../core-upgrade.js'); +require('chai').should(); + var ParsoidConfig = require('../../lib/config/ParsoidConfig.js').ParsoidConfig; var helpers = require('./test.helpers.js'); @@ -169,6 +170,12 @@ result.should.have.length(0); }); }); + it('should not crash on gallery images', function() { + return parseWT('<gallery>\nfile:a.jpg\n</gallery>') + .then(function(result) { + result.should.have.length(0); + }); + }); it('should lint self-closing tags corrrectly', function() { return parseWT('foo<b />bar<span />baz<hr />boo<br /> <ref name="boo" />').then(function(result) { result.should.have.length(2); -- To view, visit https://gerrit.wikimedia.org/r/327125 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icb6d2062467262b087d0931e86880cb51abe6d91 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Arlolra <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
