From fe87e2df874379bc9f29ebc14d4765afb4fb7150 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 5 Nov 2021 17:16:40 -0400 Subject: [PATCH] ImportHandler: Pass the pad ID to the `import` hook This enables plugins to log the pad ID if desired. --- doc/api/hooks_server-side.md | 1 + src/node/handler/ImportHandler.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index 23428eb4e..02c7e2fe6 100644 --- a/doc/api/hooks_server-side.md +++ b/doc/api/hooks_server-side.md @@ -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` diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index 7e3313524..c865dcf98 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -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');