Issue #3593541: pdv_file materializes a vault-picked file into a local upload by default
What
Choosing a file from the vault is now materialized into a normal local managed file on the submission by default - handled exactly like a manual upload (real file entity, local download, present in exports and emails). Only the vault-pick path changes; manual uploads and the optional save-to-vault are untouched.
A new off-by-default element setting, Link to the vault file, keeps the previous reference-only behavior (no local copy; bytes read from the vault on download).
Real filename + MIME (read contract)
The materialized file is named and typed from the vault, not guessed. The file-read contract now returns the bytes plus the stored MIME and a server-generated filename - the item's kind plus the MIME's extension, e.g. id_card.pdf - never the owner's original filename:
VaultClientInterface::readFile()returns aVaultFilevalue object (bytes,mime,filename).ConsumerApi::readFile()generates the name + MIME server-side.- The cross-site
/rawendpoint sends them asContent-Type+Content-Disposition;RemoteVaultClientreads them back. - The webform download controller serves the real MIME (attachment disposition) instead of
application/octet-stream.
Implementation
Materialization runs in the handler's preSave, so the pdv_file composite's own postSave makes the file permanent and tracks its usage - the same path a manual upload takes.
Tests
- materialize-by-default; link mode keeps the reference;
- permanent + usage-tracked after a full
save(); - read-failure fallback (keeps the reference);
- MIME + filename on both the same-site client and the cross-site
/rawendpoint.