17
17
use Symfony \Component \HttpFoundation \Request ;
18
18
use Symfony \Component \HttpFoundation \Response ;
19
19
use Symfony \Component \HttpFoundation \Session \Flash \AutoExpireFlashBag ;
20
- use Symfony \Component \HttpFoundation \UrlHelper ;
21
20
use Symfony \Component \HttpKernel \DataCollector \DumpDataCollector ;
22
21
use Symfony \Component \HttpKernel \Event \ResponseEvent ;
23
22
use Symfony \Component \HttpKernel \KernelEvents ;
@@ -48,9 +47,8 @@ class WebDebugToolbarListener implements EventSubscriberInterface
48
47
private string $ excludedAjaxPaths ;
49
48
private ?ContentSecurityPolicyHandler $ cspHandler ;
50
49
private ?DumpDataCollector $ dumpDataCollector ;
51
- private ?UrlHelper $ urlHelper ;
52
50
53
- public function __construct (Environment $ twig , bool $ interceptRedirects = false , int $ mode = self ::ENABLED , UrlGeneratorInterface $ urlGenerator = null , string $ excludedAjaxPaths = '^/bundles|^/_wdt ' , ContentSecurityPolicyHandler $ cspHandler = null , DumpDataCollector $ dumpDataCollector = null , UrlHelper $ urlHelper = null )
51
+ public function __construct (Environment $ twig , bool $ interceptRedirects = false , int $ mode = self ::ENABLED , UrlGeneratorInterface $ urlGenerator = null , string $ excludedAjaxPaths = '^/bundles|^/_wdt ' , ContentSecurityPolicyHandler $ cspHandler = null , DumpDataCollector $ dumpDataCollector = null )
54
52
{
55
53
$ this ->twig = $ twig ;
56
54
$ this ->urlGenerator = $ urlGenerator ;
@@ -59,7 +57,6 @@ public function __construct(Environment $twig, bool $interceptRedirects = false,
59
57
$ this ->excludedAjaxPaths = $ excludedAjaxPaths ;
60
58
$ this ->cspHandler = $ cspHandler ;
61
59
$ this ->dumpDataCollector = $ dumpDataCollector ;
62
- $ this ->urlHelper = $ urlHelper ;
63
60
}
64
61
65
62
public function isEnabled (): bool
@@ -116,12 +113,7 @@ public function onKernelResponse(ResponseEvent $event): void
116
113
$ session ->getFlashBag ()->setAll ($ session ->getFlashBag ()->peekAll ());
117
114
}
118
115
119
- $ location = $ response ->headers ->get ('Location ' );
120
- $ response ->setContent ($ this ->twig ->render ('@WebProfiler/Profiler/toolbar_redirect.html.twig ' , [
121
- 'location ' => $ location ,
122
- 'host ' => $ request ->getSchemeAndHttpHost (),
123
- 'absolute_url ' => $ this ->urlHelper ?->getAbsoluteUrl($ location ),
124
- ]));
116
+ $ response ->setContent ($ this ->twig ->render ('@WebProfiler/Profiler/toolbar_redirect.html.twig ' , ['location ' => $ response ->headers ->get ('Location ' ), 'host ' => $ request ->getSchemeAndHttpHost ()]));
125
117
$ response ->setStatusCode (200 );
126
118
$ response ->headers ->remove ('Location ' );
127
119
}
0 commit comments