Skip to content

Commit

Permalink
Merge pull request #1149 from hknustwmf/master
Browse files Browse the repository at this point in the history
Removed mwUtil.decodeBody
  • Loading branch information
Pchelolo committed Jun 5, 2019
2 parents 1fa9433 + 95cc068 commit 00c09ca
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
19 changes: 0 additions & 19 deletions lib/mwUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const contentType = require('content-type');
const jwt = require('jsonwebtoken');
const P = require('bluebird');
const entities = require('entities');
const gunzip = P.promisify(require('zlib').gunzip);
const Title = require('mediawiki-title').Title;
const HyperSwitch = require('hyperswitch');
const querystring = require('querystring');
Expand Down Expand Up @@ -272,24 +271,6 @@ mwUtil.decodePagingToken = (hyper, token) => {
}
};

mwUtil.decodeBody = (contentResponse) => {
let prepare;
if (contentResponse.headers &&
contentResponse.headers['content-encoding'] === 'gzip') {
delete contentResponse.headers['content-encoding'];
prepare = gunzip(contentResponse.body);
} else {
prepare = P.resolve(contentResponse.body);
}
return prepare.then((body) => {
if (body && Buffer.isBuffer(body)) {
body = body.toString();
}
contentResponse.body = body;
return contentResponse;
});
};

/**
*
* @param {!HyperSwitch} hyper HyperSwitch context
Expand Down
4 changes: 1 addition & 3 deletions sys/parsoid.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,7 @@ class ParsoidService {
.then((revInfo) => {
rp.revision = revInfo.rev;
})
.then(() => P.join(
this._getPageBundleFromParsoid(hyper, req),
mwUtil.decodeBody(currentContentRes))
.then(() => P.join(this._getPageBundleFromParsoid(hyper, req), currentContentRes)
.spread((res, currentContentRes) => {
const tid = uuid.now().toString();
const etag = mwUtil.makeETag(rp.revision, tid);
Expand Down

0 comments on commit 00c09ca

Please sign in to comment.