Problem/Motivation
Similar to issue #3232756 but with submission bulk archive export.
When using the file_encrypt module on a webform field and trying to download the submissions, files are not decrypted when exporting submissions.
This is because the realpath of the whole directory is used.
( // Managed files are bulk copied during an export.)
Steps to reproduce
- Enable and configure the file_encrypt module
- Create a webform with a managed file element
- Configure the element so the target storage is the file_encrypt storage
- Add a submission
- Go to the Results > Download page of the webform
- Check the "Download uploaded files" checkbox and export
Proposed resolution
Do a special case for encrypt streamwrapper near WebformSubmissionExporter.php#L865 and/or WebformSubmissionExporter.php#L886
For encrypt stream wrapper, we should use file_get_contents from each file uri and don't use the dir realpath
Remaining tasks
Validate that we really want a special case for encrypt here
Comment | File | Size | Author |
---|---|---|---|
#8 | 3330236-webform-encrypted_files_export-8.patch | 3.07 KB | JoshaHubbers |
Issue fork webform-3330236
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
clement.ferrier CreditAttribution: clement.ferrier commentedComment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedI am guessing there has to be a more generic way to support other stream wrappers.
Comment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedThe patch makes sense. I am not seeing any other approached but we might be able to streamline and isolate the file_encrypt related code.
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedI tried to replicate the issue using the https://www.drupal.org/project/file_encrypt module but could not get it setup to work as expected. The module is still in alpha release. I think the patch should be used AS-IS.
Comment #7
JoshaHubbers CreditAttribution: JoshaHubbers at iO commentedAdded patch file of the diff because the diff can change.
Comment #8
JoshaHubbers CreditAttribution: JoshaHubbers at iO commentedAdded one extra check. Got an error in a form where private and encrypted files were mixed.