ImportHandler: Pass the pad ID to the `import` hook

This enables plugins to log the pad ID if desired.
pull/5260/head
Richard Hansen 2021-11-05 17:16:40 -04:00
parent caf4e9f28c
commit fe87e2df87
2 changed files with 2 additions and 1 deletions

View File

@ -819,6 +819,7 @@ Context properties:
* `destFile`: The destination HTML filename.
* `fileEnding`: The lower-cased filename extension from `srcFile`.
* `padId`: The identifier of the destination pad.
* `srcFile`: The document to convert.
## `userJoin`

View File

@ -143,7 +143,7 @@ const doImport = async (req, res, padId) => {
const destFile = path.join(tmpDirectory, `etherpad_import_${randNum}.${exportExtension}`);
const importHandledByPlugin =
(await hooks.aCallAll('import', {srcFile, destFile, fileEnding})).some((x) => x);
(await hooks.aCallAll('import', {srcFile, destFile, fileEnding, padId})).some((x) => x);
const fileIsEtherpad = (fileEnding === '.etherpad');
const fileIsHTML = (fileEnding === '.html' || fileEnding === '.htm');
const fileIsTXT = (fileEnding === '.txt');