Skip to content

Commit 7c82c60

Browse files
Merge branch '3.1'
* 3.1: (30 commits) Fix merge [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5 [Console] fixed PHPDoc [Cache] Fix double fetch in ProxyAdapter [travis] HHVM 3.12 LTS Fix feature detection for IE [Form] Fixed collapsed choice attributes [Console] added explanation of messages usage in a progress bar force enabling the external XML entity loaders [Yaml] properly count skipped comment lines [WebProfilerBundle] Fix invalid CSS style Added progressive jpeg to mime types guesser [Yaml] Fix wrong line number when comments are inserted in the middle of a block. Fixed singular of committee Fixed singular of committee Do not inject web debug toolbar on attachments Fixed issue with legacy client initialization [FrameworkBundle] Remove unused variable bumped Symfony version to 3.0.8 updated VERSION for 3.0.7 ...
2 parents 1050eec + dd5b79e commit 7c82c60

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

EventListener/WebDebugToolbarListener.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public function onKernelResponse(FilterResponseEvent $event)
103103
|| $response->isRedirection()
104104
|| ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
105105
|| 'html' !== $request->getRequestFormat()
106+
|| false !== stripos($response->headers->get('Content-Disposition'), 'attachment;')
106107
) {
107108
return;
108109
}

Resources/views/Profiler/base_js.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
var addEventListener;
225225
226226
var el = document.createElement('div');
227-
if (!'addEventListener' in el) {
227+
if (!('addEventListener' in el)) {
228228
addEventListener = function (element, eventName, callback) {
229229
element.attachEvent('on' + eventName, callback);
230230
};

Resources/views/Router/panel.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<h3>Route Redirection</h3>
3131

3232
<p>This page redirects to:</p>
33-
<div class="card" style="break-long-words">
33+
<div class="card break-long-words">
3434
{{ router.targetUrl }}
3535
{% if router.targetRoute %}<span class="text-muted">(route: "{{ router.targetRoute }}")</span>{% endif %}
3636
</div>

Tests/EventListener/WebDebugToolbarListenerTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ public function testToolbarIsInjected()
8383
$this->assertEquals("<html><head></head><body>\nWDT\n</body></html>", $response->getContent());
8484
}
8585

86+
/**
87+
* @depends testToolbarIsInjected
88+
*/
89+
public function testToolbarIsNotInjectedOnContentDispositionAttachment()
90+
{
91+
$response = new Response('<html><head></head><body></body></html>');
92+
$response->headers->set('Content-Disposition', 'attachment; filename=test.html');
93+
$event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'html'), HttpKernelInterface::MASTER_REQUEST, $response);
94+
95+
$listener = new WebDebugToolbarListener($this->getTwigMock());
96+
$listener->onKernelResponse($event);
97+
98+
$this->assertEquals('<html><head></head><body></body></html>', $response->getContent());
99+
}
100+
86101
/**
87102
* @depends testToolbarIsInjected
88103
* @dataProvider provideRedirects

0 commit comments

Comments
 (0)