ImportHandler: Use truthiness to signal conversion handled
parent
edf99dc811
commit
caf4e9f28c
|
@ -812,8 +812,8 @@ exports.exportEtherpadAdditionalContent = () => ['comments'];
|
||||||
Called from: `src/node/handler/ImportHandler.js`
|
Called from: `src/node/handler/ImportHandler.js`
|
||||||
|
|
||||||
Called when a user submits a document for import, before the document is
|
Called when a user submits a document for import, before the document is
|
||||||
converted to HTML. The hook function should return `undefined` (or an empty
|
converted to HTML. The hook function should return a truthy value if the hook
|
||||||
list) if it did NOT convert convert the document to HTML.
|
function elected to convert the document to HTML.
|
||||||
|
|
||||||
Context properties:
|
Context properties:
|
||||||
|
|
||||||
|
|
|
@ -142,11 +142,8 @@ const doImport = async (req, res, padId) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const destFile = path.join(tmpDirectory, `etherpad_import_${randNum}.${exportExtension}`);
|
const destFile = path.join(tmpDirectory, `etherpad_import_${randNum}.${exportExtension}`);
|
||||||
|
const importHandledByPlugin =
|
||||||
// Logic for allowing external Import Plugins
|
(await hooks.aCallAll('import', {srcFile, destFile, fileEnding})).some((x) => x);
|
||||||
const result = await hooks.aCallAll('import', {srcFile, destFile, fileEnding});
|
|
||||||
const importHandledByPlugin = (result.length > 0); // This feels hacky and wrong..
|
|
||||||
|
|
||||||
const fileIsEtherpad = (fileEnding === '.etherpad');
|
const fileIsEtherpad = (fileEnding === '.etherpad');
|
||||||
const fileIsHTML = (fileEnding === '.html' || fileEnding === '.htm');
|
const fileIsHTML = (fileEnding === '.html' || fileEnding === '.htm');
|
||||||
const fileIsTXT = (fileEnding === '.txt');
|
const fileIsTXT = (fileEnding === '.txt');
|
||||||
|
|
Loading…
Reference in New Issue