Token replacement generate leaked cache metadata

Created on 13 August 2019, over 5 years ago
Updated 4 December 2024, 14 days ago

filefield_paths_process_string() which handles file's name & path to transformations makes use of token replacement.

In some case, token replacement leads to triggering some rendering. When this occurs in a "non-webpage" context, such as JSON:API or REST requests, this rendering create caching metadata which bubble up and is never catched/handled, leading to one of the most absconse/undebuggable error of a D8 project right now : the dreaded

"LogicException: The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early"

I think filefield_paths_process_string() must wrap its logic in a render context to catch the generated metadata and handle it.

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇨🇦Canada garphy

Live updates comments and jobs are added and updated live.
  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024