- last update
over 1 year ago 3 pass - 🇧🇾Belarus dewalt
The issue takes place when export files are stored to the private location. Hook "hook_file_download()" allows add headers to private files. Patch below adds the hook to the module. Also with this change JSON download also works in Safari.
- last update
over 1 year ago 3 pass - 🇧🇾Belarus dewalt
I'm not sure what encoding is needed for filename inside of "Content-disposition" header, in Chrome and Safari it works with backslashes, URL encode and plane, even if filename has quotes. So I keep it plain, same to implementation in the module in DataExport::buildStandard()
- 🇺🇸United States maskedjellybean Portland, OR
I have this problem but I'm not using the private file system (only public), so the patch doesn't help me. I tried the event subscriber in #3, and while it did work, it seems a little overbearing to run that if statement on every page request across the site on the off chance that the request contains "csv". Adding to
.htaccess
as suggested in #2 didn't work for me.In the end I did what was suggested by the reporter: Set the file name in the views path settings.
This is a bug for sure, but at least it's easily worked around.
- First commit to issue fork.
- Merge request !65Issue #3103807 by dewalt: Adds Content-disposition header on file download → (Open) created by mradcliffe
- 🇺🇸United States mradcliffe USA
I created a merge request based on @dewalt's patch and committed with them as the author of the commit.
- Status changed to RTBC
9 days ago 2:35pm 30 April 2025 - 🇺🇸United States joshua.boltz
For a while now, using this module, we have seen inconsistent report downloads -- sometimes they would download instantly, sometimes they wouldn't and the user would need to click the link to download the file.
The other issue we found that led me to this issue to begin with, was that in Safari, after generating an export, Safari would present the user with the JSON blob of content, which is probably scary to a user as it's JSON and doesn't look like the Drupal page anymore.
This patch indeed fixes that issue where the file is downloaded and they remain on the Drupal theme.
So, this patch resolves 2 issues for us:
1. The Safari file download issue with JSON blob
2. The automatic download functionality