From 2637da5328cb2230313aed58fd74ceb72426036e Mon Sep 17 00:00:00 2001 From: inFreeRED Date: Thu, 1 May 2025 21:43:47 +0200 Subject: [PATCH 1/2] Attachment parts with subtype should be considered as standalone attchments --- src/Structure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Structure.php b/src/Structure.php index 11f4cd66..cd296c49 100644 --- a/src/Structure.php +++ b/src/Structure.php @@ -115,7 +115,7 @@ private function parsePart(string $context, int $part_number = 0): array { if (($boundary = $headers->getBoundary()) !== null) { $parts = $this->detectParts($boundary, $body, $part_number); - if(count($parts) > 1) { + if (count($parts) > 1 || !empty($parts[0]->subtype)) { return $parts; } } From e2c35fb500817b40b9a9a73cfb32f60ea0f5b023 Mon Sep 17 00:00:00 2001 From: Nick Nenia Date: Wed, 11 Jun 2025 15:24:11 +0300 Subject: [PATCH 2/2] Trim the spaces from boundary --- src/Header.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Header.php b/src/Header.php index d18e98a1..aaa40e35 100644 --- a/src/Header.php +++ b/src/Header.php @@ -193,7 +193,7 @@ public function getBoundary(): ?string { * @return string */ private function clearBoundaryString(string $str): string { - return str_replace(['"', '\r', '\n', "\n", "\r", ";", "\s"], "", $str); + return trim(str_replace(['"', '\r', '\n', "\n", "\r", ";", "\s"], "", $str)); } /**