fix(core): Fix missing execution ID in webhook-based workflow producing binary data (#7244)

Story: https://linear.app/n8n/issue/PAY-839

This is a longstanding bug, fixed now so that the S3 backend for binary
data can use execution IDs as part of the filename.

To reproduce:

1. Set up a workflow with a POST Webhook node that accepts binary data.
2. Activate the workflow and call it sending a binary file, e.g. `curl
-X POST -F "file=@/path/to/binary/file/test.jpg"
http://localhost:5678/webhook/uuid`
3. Check `~/.n8n/binaryData`. The binary data and metadata files will be
missing the execution ID, e.g. `11869055-83c4-4493-876a-9092c4708b9b`
instead of `39011869055-83c4-4493-876a-9092c4708b9b`.
This commit is contained in:
Iván Ovejero
2023-09-25 12:30:28 +02:00
committed by GitHub
parent dcc9cc13ed
commit 33991e92d0
6 changed files with 156 additions and 0 deletions

View File

@@ -65,6 +65,7 @@ import {
prepareExecutionDataForDbUpdate,
updateExistingExecution,
} from './executionLifecycleHooks/shared/sharedHookFunctions';
import { restoreBinaryDataId } from './executionLifecycleHooks/restoreBinaryDataId';
const ERROR_TRIGGER_TYPE = config.getEnv('nodes.errorTriggerType');
@@ -446,6 +447,10 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
workflowId: this.workflowData.id,
});
if (this.mode === 'webhook' && config.getEnv('binaryDataManager.mode') === 'filesystem') {
await restoreBinaryDataId(fullRunData, this.executionId);
}
const isManualMode = [this.mode, parentProcessMode].includes('manual');
try {