Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f3458fb

Browse filesBrowse files
committed
fixup
1 parent 7631709 commit f3458fb
Copy full SHA for f3458fb

File tree

Expand file treeCollapse file tree

3 files changed

+13
-5
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+13
-5
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\HttpFoundation\Request;
1818
use Symfony\Component\HttpFoundation\Response;
1919
use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag;
20+
use Symfony\Component\HttpFoundation\UrlHelper;
2021
use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
2122
use Symfony\Component\HttpKernel\Event\ResponseEvent;
2223
use Symfony\Component\HttpKernel\KernelEvents;
@@ -47,8 +48,9 @@ class WebDebugToolbarListener implements EventSubscriberInterface
4748
private string $excludedAjaxPaths;
4849
private ?ContentSecurityPolicyHandler $cspHandler;
4950
private ?DumpDataCollector $dumpDataCollector;
51+
private ?UrlHelper $urlHelper;
5052

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)
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)
5254
{
5355
$this->twig = $twig;
5456
$this->urlGenerator = $urlGenerator;
@@ -57,6 +59,7 @@ public function __construct(Environment $twig, bool $interceptRedirects = false,
5759
$this->excludedAjaxPaths = $excludedAjaxPaths;
5860
$this->cspHandler = $cspHandler;
5961
$this->dumpDataCollector = $dumpDataCollector;
62+
$this->urlHelper = $urlHelper;
6063
}
6164

6265
public function isEnabled(): bool
@@ -113,7 +116,12 @@ public function onKernelResponse(ResponseEvent $event): void
113116
$session->getFlashBag()->setAll($session->getFlashBag()->peekAll());
114117
}
115118

116-
$response->setContent($this->twig->render('@WebProfiler/Profiler/toolbar_redirect.html.twig', ['location' => $response->headers->get('Location'), 'host' => $request->getSchemeAndHttpHost()]));
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+
]));
117125
$response->setStatusCode(200);
118126
$response->headers->remove('Location');
119127
}

‎src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
abstract_arg('paths that should be excluded from the AJAX requests shown in the toolbar'),
2626
service('web_profiler.csp.handler'),
2727
service('data_collector.dump')->ignoreOnInvalid(),
28+
service('url_helper')->ignoreOnInvalid(),
2829
])
2930
->tag('kernel.event_subscriber')
3031
;

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_redirect.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_redirect.html.twig
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@
3939
<div class="block-exception">
4040
<h1>Redirection Intercepted</h1>
4141

42-
{% set absolute_url = host in location or not (location starts with '/') ? location : host ~ location %}
43-
<p>This request redirects to <strong>{{ absolute_url }}</strong></p>
42+
<p>This request redirects to <strong>{{ absolute_url ?? location }}</strong></p>
4443

45-
<p><a class="btn" href="{{ location }}">Follow redirect</a></p>
44+
<p><a class="btn" href="{{ absolute_url ?? location }}">Follow redirect</a></p>
4645

4746
<p class="sf-redirection-help">
4847
The redirect was intercepted by the Symfony Web Debug toolbar to help debugging.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.