A machine-readable guide to this site for AI agents and language models is available at/llms.txt(https://dev.acquia.com/llms.txt on the production site).
Replace uploaded files with a new file version and have the path and filename remain the same | Cloud Platform | Acquia Product Documentation
Cloud Platform
Replace uploaded files with a new file version and have the path and filename remain the same
Replace uploaded files with a new file version and have the path and filename remain the same
Date Published: June 26, 2023
Issue
Deleting a file and replacing it with a new version while retaining the same filename does not work, as the new version would automatically get a prefix (_0) attached to it each time a new version is uploaded (for example: filename_0.pdf; filename_1.pdf, etc.).
Use the Media Entity Download module. It allows linking content to media/{media_id}/download no matter the filename.
Caveats:
Depending upon your site architecture and number of files using this strategy, there might be a performance impact since Drupal will be bootstraped to fetch and return the unique route
The major caveat with this approach is that the outdated versions of the files can be stuck in one of several places Varnish, Acquia Edge, Platform CDN, or even an external CDN. To get around this one of the following modules can be used in conjunction with either of the above:
The need for either of these approaches is usually only necessary on sites which may have a large number of files managed by a potentially large number of users. In this case, you may want to explore using one or both of the following modules as well. They have good track records of making files in Drupal easier to manage.