- Issue created by @codebymikey
- Merge request !35Issue #3420422: Ensure redirects work without leaking metadata β (Open) created by codebymikey
- Status changed to Needs review
5 months ago 3:23pm 9 February 2024 Initially thought of adding a wrapper around the code which returns the cacheable responses using a helper function like this:
/** * Returns a trusted response. * * Taking into account any bubbleable metadata generated. * * @param callable $callable * The callable to resolve the relevant response. * * @return \Drupal\Core\Cache\CacheableResponseInterface|mixed * The response. */ protected function wrapResponse(callable $callable) { $render_context = new RenderContext(); $cacheable_metadata = new BubbleableMetadata(); $response = $this->renderer->executeInRenderContext($render_context, $callable); if ($response) { if (!$render_context->isEmpty()) { $metadata = $render_context->pop(); $cacheable_metadata->addCacheableDependency($metadata); } if ($response instanceof CacheableResponseInterface) { $response->addCacheableDependency($cacheable_metadata); } elseif (is_array($response)) { BubbleableMetadata::createFromRenderArray($response) ->merge($cacheable_metadata) ->applyTo($response); } } return $response; }
But it's probably not necessary, and makes the code a bit more ugly to maintain, so opted for stopping the specific metadata we're aware of from leaking.
I added a 3420422-on-3295745-redirect-support branch for supporting redirects in a way that's compatible with π Make it possible to use multiple Office 365 connectors (5.x) RTBC , as well as a static patch that's compatible with #18 π Make it possible to use multiple Office 365 connectors (5.x) RTBC (3.0.25)