From e5976554b2105ffd44f87e5f4a8f602b38ca0a3f Mon Sep 17 00:00:00 2001 From: Kai Eichinger Date: Tue, 14 Sep 2021 11:56:46 +0200 Subject: [PATCH] Map `multipart/form-data` as `form` Content-Type As per RFC 2045 and RFC 2388, the `multipart/form-data` Content-Type should be used when submitting a mixed form containing files, binary data and non-ASCII data. This commit helps with infrastructure that is directly checking against the `Request::getContentType()` method in scenarios, where a mixed form has been submitted. Resolves #34240 --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- src/Symfony/Component/HttpFoundation/Tests/RequestTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index a0594c4ecb83a..4ee3f7dcfc58c 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1988,7 +1988,7 @@ protected static function initializeFormats() 'rdf' => ['application/rdf+xml'], 'atom' => ['application/atom+xml'], 'rss' => ['application/rss+xml'], - 'form' => ['application/x-www-form-urlencoded'], + 'form' => ['application/x-www-form-urlencoded', 'multipart/form-data'], ]; } diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index cf9f397a8a852..227c1b51d6fe5 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -501,6 +501,7 @@ public function getFormatToMimeTypeMapProvider() ['xml', ['text/xml', 'application/xml', 'application/x-xml']], ['rdf', ['application/rdf+xml']], ['atom', ['application/atom+xml']], + ['form', ['application/x-www-form-urlencoded', 'multipart/form-data']], ]; }