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

Change subject: html2html should require an original or previous revision
......................................................................


html2html should require an original or previous revision

 * And remove a comment only relevant to the deprecated dpContentType.

Change-Id: Ia27ed454014df1c3e258ba5e1e3ba54cfd42045b
---
M lib/api/routes.js
M tests/mocha/api.js
2 files changed, 12 insertions(+), 4 deletions(-)

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



diff --git a/lib/api/routes.js b/lib/api/routes.js
index 340d74a..f11aa70 100644
--- a/lib/api/routes.js
+++ b/lib/api/routes.js
@@ -657,10 +657,6 @@
                        }
                }
 
-               // FIXME(subbu): As a fallback, lookup the content types
-               // in the <head> of doc and/or env.page.dom
-               // For now, ignoring this.
-
                return DU.serializeDOM(env, doc.body, 
env.conf.parsoid.useSelser)
                // .timeout(REQ_TIMEOUT)
                .then(function(output) {
@@ -680,6 +676,10 @@
                var opts = res.locals.opts;
 
                var revision = opts.previous || opts.original;
+               if (!revision || !revision.html) {
+                       return apiUtils.fatalRequest(env, 'Missing revision 
html.', 400);
+               }
+
                env.originalVersion = apiUtils.versionFromType(revision.html);
                if (env.originalVersion === null) {
                        return apiUtils.fatalRequest(env, 'Content-type of 
revision html is missing.', 400);
diff --git a/tests/mocha/api.js b/tests/mocha/api.js
index 3c383bf..6af99b5 100644
--- a/tests/mocha/api.js
+++ b/tests/mocha/api.js
@@ -1434,6 +1434,14 @@
 
        describe('html2html', function() {
 
+               it('should require an original or previous version', 
function(done) {
+                       request(api)
+                       .post(mockDomain + 
'/v3/transform/pagebundle/to/pagebundle/Reuse_Page/100')
+                       .send({})
+                       .expect(400)
+                       .end(done);
+               });
+
                var previousRevHTML = {
                        revid: 99,
                        html: {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia27ed454014df1c3e258ba5e1e3ba54cfd42045b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: C. Scott Ananian <canan...@wikimedia.org>
Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to