Links to files in blocks generate @/file permalinks that lead to 404s

I’m creating a page with a text block that includes links to files that were separately uploaded to that page via two custom blocks with type: files (one has accept.type: document and the other has accept.type: image).

The text block of that page renders the links with permalink URLs (e.g. href="/@/file/...") but those URLs lead to 404s.

Opening the files in the panel shows that they do get proper /media URLs that do exist in the file system as well (i.e. I can open the files in the browser with the /media URL but not the /@/file permalink).

This seems to be specific to how custom blocks are rendered. Adding a default image block to the page (as opposed to linking to an image file) works (the image block renders an image with a /media URL).

site/blueprints/files/document.yml:

title: Document
accept:
  type: document

site/blueprints/files/blocks/document.yml:

extends: files/document

site/templates/page.php:

<?php snippet('header') ?>

<h1><?= $page->title()->esc() ?></h1>
<?= $page->text()->toBlocks() ?>

<?php snippet('footer') ?>

I’m using the following tools with a local ddev setup:

  • Windows + PowerShell 7.5.4
  • PHP 8.4.11
  • ddev 1.24.7
  • composer 2.8.10
  • getkirby/cms 5.2.0

Are you running ddev with Apache or Nginx?

My .ddev/config.yaml has webserver_type: nginx-fpm.

What if you switch to Apache?

What if you switch to Apache?

Seems to behave virtually the same. The link to /@/file/$uuid leads me to my 404 page.