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 38692a6

Browse filesBrowse files
ycerutofabpot
authored andcommitted
[HttpKernel][WebProfilerBundle] Getting the cached client mime type instead of guessing it again
1 parent d9f87b6 commit 38692a6
Copy full SHA for 38692a6

File tree

2 files changed

+4
-38
lines changed
Filter options

2 files changed

+4
-38
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig
+2-19Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -131,31 +131,14 @@
131131
{{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.requestrequest, maxDepth: 1 }, with_context = false) }}
132132
{% endif %}
133133

134-
<h3>Uploaded files</h3>
134+
<h4>Uploaded Files</h4>
135135

136136
{% if collector.requestfiles is empty %}
137137
<div class="empty">
138138
<p>No files were uploaded</p>
139139
</div>
140140
{% else %}
141-
<table>
142-
<thead>
143-
<tr>
144-
<th scope="col">File Name</th>
145-
<th scope="col">MIME Type</th>
146-
<th scope="col" class="text-right">Size (bytes)</th>
147-
</tr>
148-
</thead>
149-
<tbody>
150-
{% for file in collector.requestfiles %}
151-
<tr>
152-
<td>{{ file.name }}</td>
153-
<td>{{ file.mimetype }}</td>
154-
<td class="text-right">{{ file.size|number_format }}</td>
155-
</tr>
156-
{% endfor %}
157-
</tbody>
158-
</table>
141+
{{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.requestfiles, maxDepth: 1 }, with_context = false) }}
159142
{% endif %}
160143

161144
<h3>Request Attributes</h3>

‎src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php
+2-19Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1515
use Symfony\Component\HttpFoundation\Cookie;
16-
use Symfony\Component\HttpFoundation\File\UploadedFile;
1716
use Symfony\Component\HttpFoundation\ParameterBag;
1817
use Symfony\Component\HttpFoundation\Request;
1918
use Symfony\Component\HttpFoundation\Response;
@@ -58,22 +57,6 @@ public function collect(Request $request, Response $response, \Exception $except
5857
$content = false;
5958
}
6059

61-
$requestFiles = array();
62-
$extractFiles = function (array $files) use (&$extractFiles, &$requestFiles) {
63-
foreach ($files as $file) {
64-
if ($file instanceof UploadedFile) {
65-
$requestFiles[] = array(
66-
'name' => $file->getClientOriginalName(),
67-
'mimetype' => $file->getMimeType(),
68-
'size' => $file->getSize(),
69-
);
70-
} elseif (\is_array($file)) {
71-
$extractFiles($file);
72-
}
73-
}
74-
};
75-
$extractFiles($request->files->all());
76-
7760
$sessionMetadata = array();
7861
$sessionAttributes = array();
7962
$session = null;
@@ -112,7 +95,7 @@ public function collect(Request $request, Response $response, \Exception $except
11295
'status_code' => $statusCode,
11396
'request_query' => $request->query->all(),
11497
'request_request' => $request->request->all(),
115-
'request_files' => $requestFiles,
98+
'request_files' => $request->files->all(),
11699
'request_headers' => $request->headers->all(),
117100
'request_server' => $request->server->all(),
118101
'request_cookies' => $request->cookies->all(),
@@ -216,7 +199,7 @@ public function getRequestQuery()
216199

217200
public function getRequestFiles()
218201
{
219-
return $this->data['request_files']->getValue(true);
202+
return new ParameterBag($this->data['request_files']->getValue());
220203
}
221204

222205
public function getRequestHeaders()

0 commit comments

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