Hi,
I have read this post (https://www.drupal.org/node/2865107) when I was looking for to replace a file instead of rename. And, I have found this module.
I would like to be able to download a file with a specific name or, if not possible, an administrable custom name who will not change even if file is updated later.
This module allow to download a file with a unique url even if file is updated but the file who is really downloaded have the name of the last revision (like _0, _1 etc.). I think it could be valuable to offer an option who allow to specify the filename maybe using the "name" field of media bundle ?
What do you think ?
(sorry for my english)
Comments
Comment #2
kevinquillen CreditAttribution: kevinquillen at Velir commentedPathauto support would be nice, but I am not sure how to do that yet.
Comment #3
kevinquillen CreditAttribution: kevinquillen at Velir commentedComment #4
justaman CreditAttribution: justaman as a volunteer commentedYou just need to go to admin/structure/media/manage/file/form-display and drag the "name" field up to the visible region.
I am currently working on how to fetch that field programmatically :)
Comment #5
mortona2k CreditAttribution: mortona2k as a volunteer commentedI 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
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.
Comment #6
NicklasMF CreditAttribution: NicklasMF at Novicell commentedDepending on how specific we want to alter the response, if this gets approved: https://www.drupal.org/project/media_entity_download/issues/3418334.
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();
Comment #7
NicklasMF CreditAttribution: NicklasMF at Novicell commentedComment #8
NicklasMF CreditAttribution: NicklasMF at Novicell commented