mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-09 08:25:00 -04:00
Export: verify revisions are numbers
This commit is contained in:
parent
5ec9d620c3
commit
49b7051d27
3 changed files with 20 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
# Next release
|
||||||
|
|
||||||
|
### Notable enhancements and fixes
|
||||||
|
|
||||||
|
* Bugfixes
|
||||||
|
* revisions in `CHANGESET_REQ` (timeslider) and export (txt, html, custom)
|
||||||
|
are now checked to be numbers.
|
||||||
|
|
||||||
# 1.9.0
|
# 1.9.0
|
||||||
|
|
||||||
### Notable enhancements and fixes
|
### Notable enhancements and fixes
|
||||||
|
|
|
@ -29,6 +29,7 @@ const os = require('os');
|
||||||
const hooks = require('../../static/js/pluginfw/hooks');
|
const hooks = require('../../static/js/pluginfw/hooks');
|
||||||
const TidyHtml = require('../utils/TidyHtml');
|
const TidyHtml = require('../utils/TidyHtml');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
|
const { checkValidRev } = require('../utils/checkValidRev');
|
||||||
|
|
||||||
const fsp_writeFile = util.promisify(fs.writeFile);
|
const fsp_writeFile = util.promisify(fs.writeFile);
|
||||||
const fsp_unlink = util.promisify(fs.unlink);
|
const fsp_unlink = util.promisify(fs.unlink);
|
||||||
|
@ -53,6 +54,12 @@ exports.doExport = async (req, res, padId, readOnlyId, type) => {
|
||||||
// tell the browser that this is a downloadable file
|
// tell the browser that this is a downloadable file
|
||||||
res.attachment(`${fileName}.${type}`);
|
res.attachment(`${fileName}.${type}`);
|
||||||
|
|
||||||
|
if (req.params.rev !== undefined) {
|
||||||
|
// ensure revision is a number
|
||||||
|
// modify req, as we use it in a later call to exportConvert
|
||||||
|
req.params.rev = checkValidRev(req.params.rev);
|
||||||
|
}
|
||||||
|
|
||||||
// if this is a plain text export, we can do this directly
|
// if this is a plain text export, we can do this directly
|
||||||
// We have to over engineer this because tabs are stored as attributes and not plain text
|
// We have to over engineer this because tabs are stored as attributes and not plain text
|
||||||
if (type === 'etherpad') {
|
if (type === 'etherpad') {
|
||||||
|
|
|
@ -21,10 +21,14 @@
|
||||||
|
|
||||||
const AttributeMap = require('../../static/js/AttributeMap');
|
const AttributeMap = require('../../static/js/AttributeMap');
|
||||||
const Changeset = require('../../static/js/Changeset');
|
const Changeset = require('../../static/js/Changeset');
|
||||||
|
const { checkValidRev } = require('./checkValidRev');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This method seems unused in core and no plugins depend on it
|
||||||
|
*/
|
||||||
exports.getPadPlainText = (pad, revNum) => {
|
exports.getPadPlainText = (pad, revNum) => {
|
||||||
const _analyzeLine = exports._analyzeLine;
|
const _analyzeLine = exports._analyzeLine;
|
||||||
const atext = ((revNum !== undefined) ? pad.getInternalRevisionAText(revNum) : pad.atext);
|
const atext = ((revNum !== undefined) ? pad.getInternalRevisionAText(checkValidRev(revNum)) : pad.atext);
|
||||||
const textLines = atext.text.slice(0, -1).split('\n');
|
const textLines = atext.text.slice(0, -1).split('\n');
|
||||||
const attribLines = Changeset.splitAttributionLines(atext.attribs, atext.text);
|
const attribLines = Changeset.splitAttributionLines(atext.attribs, atext.text);
|
||||||
const apool = pad.pool;
|
const apool = pad.pool;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue