mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
ExportHandler: Replace unnecessary exception with return
This commit is contained in:
parent
785b7d2b44
commit
59c167e31b
1 changed files with 2 additions and 10 deletions
|
@ -43,7 +43,7 @@ const tempDirectory = os.tmpdir();
|
||||||
/**
|
/**
|
||||||
* do a requested export
|
* do a requested export
|
||||||
*/
|
*/
|
||||||
const doExport = async (req, res, padId, readOnlyId, type) => {
|
exports.doExport = async (req, res, padId, readOnlyId, type) => {
|
||||||
// avoid naming the read-only file as the original pad's id
|
// avoid naming the read-only file as the original pad's id
|
||||||
let fileName = readOnlyId ? readOnlyId : padId;
|
let fileName = readOnlyId ? readOnlyId : padId;
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ const doExport = async (req, res, padId, readOnlyId, type) => {
|
||||||
const newHTML = await hooks.aCallFirst('exportHTMLSend', html);
|
const newHTML = await hooks.aCallFirst('exportHTMLSend', html);
|
||||||
if (newHTML.length) html = newHTML;
|
if (newHTML.length) html = newHTML;
|
||||||
res.send(html);
|
res.send(html);
|
||||||
throw 'stop';
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// else write the html export to a file
|
// else write the html export to a file
|
||||||
|
@ -121,11 +121,3 @@ const doExport = async (req, res, padId, readOnlyId, type) => {
|
||||||
await fsp_unlink(destFile);
|
await fsp_unlink(destFile);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.doExport = (req, res, padId, readOnlyId, type) => {
|
|
||||||
doExport(req, res, padId, readOnlyId, type).catch((err) => {
|
|
||||||
if (err !== 'stop') {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue