File tree 2 files changed +3
-2
lines changed
src/Symfony/Component/Mime
2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,8 @@ private function createParameter(string $name, string $value): string
158
158
*/
159
159
private function getEndOfParameterValue (string $ value , bool $ encoded = false , bool $ firstLine = false ): string
160
160
{
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 )) {
162
163
$ value = '" ' .$ value .'" ' ;
163
164
}
164
165
$ prepend = '= ' ;
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ public function getPreparedHeaders(): Headers
129
129
if ($ this ->charset ) {
130
130
$ headers ->setHeaderParameter ('Content-Type ' , 'charset ' , $ this ->charset );
131
131
}
132
- if ($ this ->name ) {
132
+ if ($ this ->name && ' form-data ' !== $ this -> disposition ) {
133
133
$ headers ->setHeaderParameter ('Content-Type ' , 'name ' , $ this ->name );
134
134
}
135
135
$ headers ->setHeaderBody ('Text ' , 'Content-Transfer-Encoding ' , $ this ->encoding );
You can’t perform that action at this time.
0 commit comments