Skip to content

Commit

Permalink
Merge c9a7d1d into 7034676
Browse files Browse the repository at this point in the history
  • Loading branch information
Pchelolo committed Sep 24, 2018
2 parents 7034676 + c9a7d1d commit 3cf3fd4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion sys/parsoid.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ class ParsoidService {
getFormat(format, hyper, req) {
const rp = req.params;
const generateContent = (storageRes) => {
if (storageRes.status === 404 || storageRes.status === 200) {
if (!rp.tid && (storageRes.status === 404 || storageRes.status === 200)) {
return this.generateAndSave(hyper, req, format, storageRes);
} else {
// Don't generate content if there's some other error.
Expand Down
13 changes: 13 additions & 0 deletions test/features/parsoid/ondemand/ondemand.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const assert = require('../../../utils/assert.js');
const server = require('../../../utils/server.js');
const preq = require('preq');
const mwUtil = require('../../../../lib/mwUtil');
const uuid = require('cassandra-uuid');

const revA = '275843';
const revB = '275844';
Expand Down Expand Up @@ -57,6 +58,18 @@ describe('on-demand generation of html and data-parsoid', function() {
});
});

it('should not transparently create revision B via Parsoid if TID is provided', () => {
const slice = server.config.logStream.slice();
return preq.get({
uri: `${pageUrl}/html/${title}/${revB}/${uuid.TimeUuid.now().toString()}`,
})
.then((res) => {
throw new Error('404 should have been thrown');
}, (e) => {
assert.deepEqual(e.status, 404);
});
});

let revBETag;
it('should retrieve html revision B from storage', () => {
const slice = server.config.logStream.slice();
Expand Down
21 changes: 1 addition & 20 deletions test/features/parsoid/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ parallel('transform api', function() {

it('supports reversed order of properties in TimeUuid meta', () => {
const newHtml = testPage.html.replace(/<meta property="mw:TimeUuid" content="([^"]+)"\/?>/,
'<meta content="cc8ba6b3-636c-11e5-b601-24b4f65ab671" property="mw:TimeUuid" />');
'<meta content="$1" property="mw:TimeUuid" />');
return preq.post({
uri: `${server.config.labsURL
}/transform/html/to/wikitext/${testPage.title
Expand All @@ -396,25 +396,6 @@ parallel('transform api', function() {
});
});

it('returns 409 if revision was restricted while edit happened', () => {
const badPageName = 'User_talk:DivineAlpha%2fQ1_2015_discussions';
const badRevNumber = 645504917;
return preq.post({
uri: `${server.config.baseURL
}/transform/html/to/wikitext/${badPageName}/${badRevNumber}`,
body: {
html: '<html><head>' +
'<meta property="mw:TimeUuid" content="71966eaf-62cd-11e5-8a88-952fdaad0387"/>' +
'</head><body></body></html>'
}
})
.then(() => {
throw new Error('Error should be thrown');
}, (e) => {
assert.deepEqual(e.status, 409);
});
});

it('supports stashing content', () => {
return preq.post({
uri: `${server.config.labsURL
Expand Down

0 comments on commit 3cf3fd4

Please sign in to comment.