Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Work in progress Breaking

98006[!!!][TASK] Prefix public URLs of files without event listeners

Benni Mack CR 0 V 0 Hard +482 −265 updated 11/25/26, 10:56

Commit message

The frontend and backend RequestHandler registered a listener for
GeneratePublicUrlForResourceEvent at runtime, which prefixed the
public URL of a file with config.absRefPrefix or the site path.
URLs generated before, for example in a middleware or an eID
script, stayed relative, a listener was added on every request,
and the prefix was determined in three places.

One place for the prefix: the new PublicUrlPrefix determines it
for a request:

* in the frontend, config.forceAbsoluteUrls or
  config.absRefPrefix from TypoScript
* before TypoScript is available, and in the backend, the site
  path
* without a request (CLI), no prefix, the URL stays relative to
  the public directory as before

FrontendUrlPrefix and the system resource publisher use it.
FrontendUrlPrefix keeps returning an empty prefix without
TypoScript. The copy of the absRefPrefix logic in the publisher
is gone, and the publisher now prefixes relative public URLs of
files for the given request in every context, not only on CLI.

Slimmer ResourceStorage: getPublicUrl() only checks whether the
storage is online and delegates to the new PublicUrlBuilder. It
takes over the event, online media, driver URL, the file dump
fallback and the cache tags, and prefixes relative URLs for the
current request.

Removed: both PublicUrlPrefixer classes and their registration
at runtime in both RequestHandler. The backend RequestHandler no
longer needs the ListenerProvider. A Breaking changelog entry and
extension scanner entries for the removed classes are added.

Behaviour changes:

* URLs of files generated in middlewares, eID scripts or redirects
  to a file are now prefixed, before they stayed relative.
* Relative URLs of any driver get the prefix, not only of storages
  using the Local driver.
* The case of SrcsetViewHelperTest that sets a frontend request
  without TypoScript now expects "/fileadmin/..." instead of
  "fileadmin/...". Its other cases set no request and still
  expect relative URLs.
Show more Show less

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 1
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/06/98006/1 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/06/98006/1 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Relation chain 3

  1. 98006 [!!!][TASK] Prefix public URLs of files without event listeners This change

  2. 97901[FEATURE] Answer requests for missing storage files This change is based on it Benni Mack → main Hard +632 −0 CR 0 V 0
  3. 97900[FEATURE] Configure the public URLs of file storages This change is based on it Benni Mack → main Hard +604 −35 CR 0 V 0

Issues 2

Files 16

Review log 12

  1. Benni Mack uploaded patch set 1 11/25/26, 10:44

  2. core-ci voted on patch set 1 V +1 11/25/26, 10:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115406