Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[WebProfilerBundle] Fix intercept external redirects#52584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_redirect.html.twig OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
smnandre commentedNov 19, 2023
Maybe we could do this computation in the Controller directly ? Currently the code look like this (just formatted for clarity) WebProfilerBundle/EventListener/WebDebugToolbarListener.php $content =$this->twig->render('@WebProfiler/Profiler/toolbar_redirect.html.twig', ['location' =>$response->headers->get('Location'),'host' =>$request->getSchemeAndHttpHost()]);$response->setContent($content);$response->setStatusCode(200);$response->headers->remove('Location'); Something like this could do the job WDYT ? $content =$this->twig->render('@WebProfiler/Profiler/toolbar_redirect.html.twig', ['location' =>$location =$response->headers->get('Location'),'absolute_location' => (newUrlHelper($requestStack))->getAbsoluteUrl($location),]);$response->setContent($content);$response->setStatusCode(200);$response->headers->remove('Location'); And that'd allow to keep in one place all those 'Location' manipulation / transformations. Because, even with the best intentions, i'm not sure the template code would be ever "obvious" (e g : WDYT ? |
nicolas-grekas commentedNov 20, 2023
I agree with@smnandre's proposal, the template can't contain this logic. |
src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_redirect.html.twig OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
16a73a6 toce01d74Comparece01d74 to4ffadecComparefabpot commentedDec 9, 2023
Thank you@HeahDude. |
When intercepting a redirect to an external host the current output gives:
With this PR, it fixes it too:
We could eventually get rid of the first part of the condition, WDYT?