[Mime] Fix compat with HTTP requests
This commit is contained in:
parent
05fe56b88e
commit
52e7d7cf17
@ -158,7 +158,8 @@ final class ParameterizedHeader extends UnstructuredHeader
|
|||||||
*/
|
*/
|
||||||
private function getEndOfParameterValue(string $value, bool $encoded = false, bool $firstLine = false): string
|
private function getEndOfParameterValue(string $value, bool $encoded = false, bool $firstLine = false): string
|
||||||
{
|
{
|
||||||
if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {
|
$forceHttpQuoting = 'content-disposition' === strtolower($this->getName()) && 'form-data' === $this->getValue();
|
||||||
|
if ($forceHttpQuoting || !preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {
|
||||||
$value = '"'.$value.'"';
|
$value = '"'.$value.'"';
|
||||||
}
|
}
|
||||||
$prepend = '=';
|
$prepend = '=';
|
||||||
|
@ -129,7 +129,7 @@ class TextPart extends AbstractPart
|
|||||||
if ($this->charset) {
|
if ($this->charset) {
|
||||||
$headers->setHeaderParameter('Content-Type', 'charset', $this->charset);
|
$headers->setHeaderParameter('Content-Type', 'charset', $this->charset);
|
||||||
}
|
}
|
||||||
if ($this->name) {
|
if ($this->name && 'form-data' !== $this->disposition) {
|
||||||
$headers->setHeaderParameter('Content-Type', 'name', $this->name);
|
$headers->setHeaderParameter('Content-Type', 'name', $this->name);
|
||||||
}
|
}
|
||||||
$headers->setHeaderBody('Text', 'Content-Transfer-Encoding', $this->encoding);
|
$headers->setHeaderBody('Text', 'Content-Transfer-Encoding', $this->encoding);
|
||||||
|
Reference in New Issue
Block a user