Issue with Generating Media Files for Downloads Page after Updating to Kirby 4 (UUIDs)

Hi Kirby community,

I need some help with a situation I’ve encountered after updating from Kirby 3.6 to Kirby 4. Here’s a brief summary of the issue and my goals:

We’ve been using a “Downloads” page to offer direct downloads for our users, and up until now, we’ve been using direct links to files from the media folder. After updating to Kirby 4, I’d like to move to using the newly introduced UUIDs for the download links to make them more reliable in the long run. To ensure the old links continue to work, I’m planning to use redirects to the new permalinks for the files.

After updating and deleting the media folder, I regenerated the UUIDs and tried accessing the download files via their permalinks. At first, this didn’t work at all. I noticed that the media/pages/downloads folder was almost empty. However, as soon as I opened a file from the Panel, a folder was generated in the media folder, and after that, the permalink worked.

My question is:
Is there a way to generate all the necessary files for the Downloads page in the media folder without manually accessing each one via the Panel? Or is there a better approach to reliably serve static downloads in Kirby? Would it be a better way to link to /downloads/filename.pdf?

Thanks in advance for your help!

The media folder is a cache folder, it doesn’t make sense to use hardcoded links to the media folder, with or without permalinks.

Files are usually copied to the media folder whenever a standard url/permalink url to a file is called, ie. on the fly. It is also possible to publish all files to the media folder with a script that looks through all files and calls $file->publish(). This is usually not necessary.

Thank you for your answer! Yes, i had to learn that now the hard way :sweat_smile:
From now on I will just link to the actual links to the files. e.g. /downloads/test.pdf