- 🇺🇸United States mortona2k Seattle
I got a request to implement this - we want to be able to replace media files with the same filename. I'm ok with media adding _1 for versioning and caching, but it would be great if it could be downloaded with a clean filename. Generating that from the media name makes sense.
I imagine we need this in place to get it working: https://www.drupal.org/project/media_entity_download/issues/3351543 ✨ Introduce hook to alter the download response Active
This is a similar issue (is it a duplicate?) https://www.drupal.org/project/media_entity_download/issues/3176548 →What are the blockers here? If one of those patches works, it may not be too difficult to get the base case for this working.
- 🇩🇰Denmark nicklasmf
Depending on how specific we want to alter the response, if this gets approved: https://www.drupal.org/project/media_entity_download/issues/3418334 ✨ Use filename in download RTBC .
We could also simply create a hook for the filename like:
$filename = $this->moduleHandler()->invokeAll('file_download_name', [$media, file]);
And then add a default return for the hook like:
$filename = $file->label();
- Status changed to Active
11 months ago 1:49pm 28 February 2024 - Status changed to Needs review
4 months ago 8:43am 12 September 2024 - 🇮🇳India dev2.addweb
Hi, I added JavaScript to prompt users to rename files before download and added checkbox in FieldFormatter to use this functionality. Please review the attached patch.