Webhook trigger file parameter falls back to the whole files mapping instead of None
- Dominant language
- TypeScript
- Stars
- 156k
- Forks
- 24.6k
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 610
Description
### Self Checks
- [x] I have searched for existing issues and confirmed this isn't a duplicate.
### Dify version
main (self-hosted, source build)
### Cloud or Self Hosted
Self Hosted
### Steps to reproduce
1. Create a webhook trigger with two file-type body parameters, e.g. `avatar` and `attachment`.
2. Send a multipart/form-data request that only includes `avatar`.
3. In a downstream node, reference the `attachment` output variable.
The same happens when a file entry is present but not a dict, or when the FileVariable can't be built.
### ✔️ Expected Behavior
A missing file parameter resolves to `None`, like query and body parameters do.
### ❌ Actual Behavior
`_extract_configured_outputs` in `api/core/workflow/nodes/trigger_webhook/node.py` assigns the entire `files` mapping to the parameter in all three fallback paths:
```python
files = webhook_data.get("files", {})
if files and isinstance(files, dict):
file = files.get(param_name)
if file and isinstance(file, dict):
...
else:
outputs[param_name] = files
else:
outputs[param_name] = files
```
So `attachment` ends up holding `avatar`'s file dict, and downstream nodes get an object with an unexpected shape instead of an unset value.
Contributor guide
Research direction
Start in api/core/workflow/nodes/trigger_webhook/node.py at _extract_configured_outputs and trace how webhook_data files are mapped to configured parameters. Reproduce the multipart request with avatar present and attachment missing, then check the non-dict and unbuildable FileVariable paths. Done means each absent or invalid file parameter resolves to None rather than the whole files mapping.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100