Skip to content

Commit 9541c55

Browse files
Merge branch '4.3' into 4.4
* 4.3: [Mailer] Remove line breaks in email attachment content Update links to documentation [Validator] Add the missing translations for the Arabic (ar) locale ensure to expect no validation for the right reasons [PhpUnitBridge] Add test case for @expectedDeprecation annotation [PhpUnitBridge][SymfonyTestsListenerTrait] Remove $testsWithWarnings stack [Mailer][MailchimpBridge] Fix missing attachments when sending via Mandrill API [Mailer][MailchimpBridge] Fix incorrect sender address when sender has name [HttpClient] fix capturing SSL certificates with NativeHttpClient [TwigBridge][Form] Added missing help messages in form themes Update year in license files Update year in license files [HttpClient] fix typo [Console][FormatterHelper] Use helper strlen statically and remove duplicated code [Routing] Fix i18n routing when the url contains the locale Fix BC issue in phpDoc Reflection library [Translator] Performance improvement in MessageCatalogue and catalogue operations.
2 parents d648712 + 3407df5 commit 9541c55

File tree

13 files changed

+125
-13
lines changed

13 files changed

+125
-13
lines changed

Amazon/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 Fabien Potencier
1+
Copyright (c) 2019-2020 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

Google/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 Fabien Potencier
1+
Copyright (c) 2019-2020 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 Fabien Potencier
1+
Copyright (c) 2019-2020 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

Mailchimp/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 Fabien Potencier
1+
Copyright (c) 2019-2020 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

Mailchimp/Transport/MandrillApiTransport.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,14 @@ private function getPayload(Email $email, Envelope $envelope): array
9494
'type' => $headers->get('Content-Type')->getBody(),
9595
];
9696

97+
if ($name = $headers->getHeaderParameter('Content-Disposition', 'name')) {
98+
$att['name'] = $name;
99+
}
100+
97101
if ('inline' === $disposition) {
98-
$payload['images'][] = $att;
102+
$payload['message']['images'][] = $att;
99103
} else {
100-
$payload['attachments'][] = $att;
104+
$payload['message']['attachments'][] = $att;
101105
}
102106
}
103107

Mailgun/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 Fabien Potencier
1+
Copyright (c) 2019-2020 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

MandrillApiTransport.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,14 @@ private function getPayload(Email $email, Envelope $envelope): array
9494
'type' => $headers->get('Content-Type')->getBody(),
9595
];
9696

97+
if ($name = $headers->getHeaderParameter('Content-Disposition', 'name')) {
98+
$att['name'] = $name;
99+
}
100+
97101
if ('inline' === $disposition) {
98-
$payload['images'][] = $att;
102+
$payload['message']['images'][] = $att;
99103
} else {
100-
$payload['attachments'][] = $att;
104+
$payload['message']['attachments'][] = $att;
101105
}
102106
}
103107

Postmark/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 Fabien Potencier
1+
Copyright (c) 2019-2020 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

Sendgrid/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 Fabien Potencier
1+
Copyright (c) 2019-2020 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

Sendgrid/Tests/Transport/SendgridApiTransportTest.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,56 @@ public function testSend()
9797
$mailer = new SendgridApiTransport('foo', $httpClient);
9898
$mailer->send($email);
9999
}
100+
101+
public function testLineBreaksInEncodedAttachment()
102+
{
103+
$email = new Email();
104+
$email->from('foo@example.com')
105+
->to('bar@example.com')
106+
// even if content doesn't include new lines, the base64 encoding performed later may add them
107+
->attach('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod', 'lorem.txt');
108+
109+
$response = $this->createMock(ResponseInterface::class);
110+
111+
$response
112+
->expects($this->once())
113+
->method('getStatusCode')
114+
->willReturn(202);
115+
$response
116+
->expects($this->once())
117+
->method('getHeaders')
118+
->willReturn(['x-message-id' => '1']);
119+
120+
$httpClient = $this->createMock(HttpClientInterface::class);
121+
122+
$httpClient
123+
->expects($this->once())
124+
->method('request')
125+
->with('POST', 'https://api.sendgrid.com/v3/mail/send', [
126+
'json' => [
127+
'personalizations' => [
128+
[
129+
'to' => [['email' => 'bar@example.com']],
130+
'subject' => null,
131+
],
132+
],
133+
'from' => ['email' => 'foo@example.com'],
134+
'content' => [],
135+
'attachments' => [
136+
[
137+
'content' => 'TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwgc2VkIGRvIGVpdXNtb2Q=',
138+
'filename' => 'lorem.txt',
139+
'type' => 'application/octet-stream',
140+
'disposition' => 'attachment',
141+
],
142+
],
143+
],
144+
'auth_bearer' => 'foo',
145+
])
146+
->willReturn($response);
147+
148+
$mailer = new SendgridApiTransport('foo', $httpClient);
149+
150+
$mailer->send($email);
151+
}
100152
}

0 commit comments

Comments
 (0)