Skip to content

Commit 78fac67

Browse files
committed
AC-10269: Gift registry frontend enhancements
* Removed unnecesary checks
1 parent dc0fea0 commit 78fac67

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

lib/internal/Magento/Framework/Mail/EmailMessage.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -277,29 +277,14 @@ private function convertAddressArrayToAddressList(array $arrayList): AddressList
277277
*/
278278
private function sanitiseEmail(?string $email): ?string
279279
{
280-
if (!empty($email)) {
280+
if (!empty($email) && str_starts_with($email, '=?')) {
281281
$decodedValue = iconv_mime_decode($email, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
282282
$localPart = explode('@', $decodedValue);
283-
if (!empty($localPart[0]) && str_starts_with($email, '=?') && str_contains($localPart[0], ' ')) {
284-
throw new LocalizedException(__('Invalid email format'));
285-
}
286-
if ($this->validateSpecialCharacters($email)) {
283+
if (!empty($localPart[0]) && str_contains($localPart[0], ' ')) {
287284
throw new LocalizedException(__('Invalid email format'));
288285
}
289286
}
290287

291288
return $email;
292289
}
293-
294-
/**
295-
* Check email contains invalid characters
296-
*
297-
* @param string $email
298-
* @return int
299-
*/
300-
private function validateSpecialCharacters(string $email): int
301-
{
302-
$localPart = explode('@', $email);
303-
return !empty($localPart[0]) ? preg_match('/^.*[#!&%~$+ ]+.*$/', $localPart[0]) : 0;
304-
}
305290
}

0 commit comments

Comments
 (0)