Skip to content

Commit 4795662

Browse files
committed
handle for whatever reason upload file input named "name"
1 parent f5574aa commit 4795662

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

spec/Handler/Writer/MailSpec.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@
5959
'type' => 'text/html'
6060
],
6161
],
62+
"file-collection2" => [
63+
"name" => [
64+
[
65+
'name' => 'foo.html',
66+
'tmp_name' => __DIR__ . '/../../Fixture/data/foo.html',
67+
'error' => 0,
68+
'size' => 1,
69+
'type' => 'text/html'
70+
]
71+
],
72+
],
6273
],
6374
'cookie_data' => [],
6475
]

src/Handler/Writer/Mail.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private function singleBodyAddPart(MimeMessage $body, array $data) : MimeMessage
9393
private function bodyAddPart(MimeMessage $body, array $data) : MimeMessage
9494
{
9595
foreach ($data as $upload) {
96-
if (\key($upload) === 'name') {
96+
if (\key($upload) === 'name' && ! is_array($upload['name'])) {
9797
$body = $this->singleBodyAddPart($body, $upload);
9898
continue;
9999
}

0 commit comments

Comments
 (0)