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 f617380

Browse filesBrowse files
committed
bug #37581 [Mime] Fix compat with HTTP requests (fabpot)
This PR was merged into the 4.4 branch. Discussion ---------- [Mime] Fix compat with HTTP requests | Q | A | ------------- | --- | Branch? | 4.4 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #37500, Fix #36738, Fix #35443 | License | MIT | Doc PR | n/a Commits ------- 52e7d7c [Mime] Fix compat with HTTP requests
2 parents b34abaf + 52e7d7c commit f617380
Copy full SHA for f617380

File tree

Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed

‎src/Symfony/Component/Mime/Header/ParameterizedHeader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Header/ParameterizedHeader.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ private function createParameter(string $name, string $value): string
158158
*/
159159
private function getEndOfParameterValue(string $value, bool $encoded = false, bool $firstLine = false): string
160160
{
161-
if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {
161+
$forceHttpQuoting = 'content-disposition' === strtolower($this->getName()) && 'form-data' === $this->getValue();
162+
if ($forceHttpQuoting || !preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {
162163
$value = '"'.$value.'"';
163164
}
164165
$prepend = '=';

‎src/Symfony/Component/Mime/Part/TextPart.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Part/TextPart.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function getPreparedHeaders(): Headers
129129
if ($this->charset) {
130130
$headers->setHeaderParameter('Content-Type', 'charset', $this->charset);
131131
}
132-
if ($this->name) {
132+
if ($this->name && 'form-data' !== $this->disposition) {
133133
$headers->setHeaderParameter('Content-Type', 'name', $this->name);
134134
}
135135
$headers->setHeaderBody('Text', 'Content-Transfer-Encoding', $this->encoding);

0 commit comments

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