AssetControllerBase does not use file_url_generator when redirecting

Created on 19 September 2024, 3 months ago

Problem/Motivation

We host multiple Drupal sites from the same domain. We have a proxy that servers all assets from path /<project_name>-assets/..., and use hook_file_url_alter() to modify the urls to achieve this.

I noticed that the AssetControllerBase redirects the request if the file hash is incorrect. The redirect file url does not go though file_url_generator service, so our hook_file_url_alter() is not run for those requests. The current string replacement is not enough in our use case.

Steps to reproduce

I replicated our setup in this repo https://github.com/hyrsky/drupal-testbench/ where this issue can be reproduced. See the README.md for more details.

Proposed resolution

Run redirect URLs through file_url_generator service.

Remaining tasks

User interface changes

No changes.

Introduced terminology

No new terminology.

API changes

No changes.

Data model changes

No changes.

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
System 

Last updated 3 days ago

No maintainer
Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024