Skip to content

Commit

Permalink
bug #31349 [WebProfilerBundle] Use absolute URL for profiler links (A…
Browse files Browse the repository at this point in the history
…lumbrados)

This PR was merged into the 3.4 branch.

Discussion
----------

[WebProfilerBundle] Use absolute URL for profiler links

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | n/a
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Generate absolute URL's so you can have a different (sub)domain for the profiler and the controller that uses it.

Also uses the link which the controller generated instead of always generating a new link in Twig. The changes shouldn't inpact normal behavior.

Commits
-------

13ee1fa Use absolute URL for when the profiler's domain differs from the controller's domain which initialises the profiler.
  • Loading branch information
nicolas-grekas committed May 22, 2019
2 parents f93e252 + 13ee1fa commit 8a220d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -164,7 +164,7 @@ public function toolbarAction(Request $request, $token)

$url = null;
try {
$url = $this->generator->generate('_profiler', ['token' => $token]);
$url = $this->generator->generate('_profiler', ['token' => $token], UrlGeneratorInterface::ABSOLUTE_URL);
} catch (\Exception $e) {
// the profiler is not enabled
}
Expand Down
@@ -1,5 +1,5 @@
<div class="sf-toolbar-block sf-toolbar-block-{{ name }} sf-toolbar-status-{{ status|default('normal') }} {{ additional_classes|default('') }}" {{ block_attrs|default('')|raw }}>
{% if link is not defined or link %}<a href="{{ path('_profiler', { token: token, panel: name }) }}">{% endif %}
{% if link is not defined or link %}<a href="{{ url('_profiler', { token: token, panel: name }) }}">{% endif %}
<div class="sf-toolbar-icon">{{ icon|default('') }}</div>
{% if link|default(false) %}</a>{% endif %}
<div class="sf-toolbar-info">{{ text|default('') }}</div>
Expand Down

0 comments on commit 8a220d8

Please sign in to comment.