Avoid redirecting assets (JS/CSS) paths

Created on 11 September 2024, 7 months ago

Problem/Motivation

When using the redirect method, aggregated assets paths like public://js/* and public://css/* are being redirected as well. This causes the styles and js to be broken when caches are cleared and a user gets redirected.

Steps to reproduce

- Install drupal core (standard profile) and entity_legal
- Setup a document and version, with redirect method required
- Create a new "test" user (no roles)
- Grant re-accept and view document permissions to authenticated users
- Now clear the cache, and attempt to login as test
> CSS and JS assets on the page are broken, because they are dedirected by entity_legal

Proposed resolution

Add system.js_asset and system.css_asset routes to redirect exclusions in \Drupal\entity_legal\Plugin\EntityLegal\Redirect::isExcludedRoute

On a bigger scope, it might be interesting to review/revisit the whole logic in this plugin/class regarding which requests can be redirected. The redirect module could be interesting to look at, see \Drupal\redirect\RedirectChecker::canRedirect

Remaining tasks

?

User interface changes

?

API changes

?

Data model changes

?

🐛 Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

🇧🇪Belgium herved

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