Issue Task Under Review

#111577Render public URLs of files without event listeners registered at runtime

Benni Mack 11/25/26, 09:48 updated 11/25/26, 10:44

Description

The public URL of a file or folder of a storage below the public directory is relative to it, like “fileadmin/file.pdf”. The frontend and backend RequestHandler register an event listener for GeneratePublicUrlForResourceEvent at runtime (PublicUrlPrefixer), which prefixes such URLs with config.absRefPrefix or the site path. This has several drawbacks:

  • URLs generated in middlewares, eID scripts or before the RequestHandler runs are not prefixed.
  • A listener is added to the shared ListenerProvider on every request.
  • The prefix logic exists three times: in both listeners and in DefaultSystemResourcePublisher, which is a copy of FrontendUrlPrefix.
  • The listeners only prefix URLs of storages with the “Local” driver and call the storage again with a static flag to avoid a loop.

The prefix should be determined in one place for every context (frontend, backend, CLI), and ResourceStorage::getPublicUrl() should delegate the URL generation (event, online media, driver, file dump eID, cache tags) to a dedicated service, so ResourceStorage becomes slimmer.

Related: #111541

Reviews 1

History 01

  1. Gerrit Code Review pushed patch set 1 for main to change 98006 status New Under Review 11/25/26, 10:44