Skip to content
Snippets Groups Projects
Verified Commit 1e5f032e authored by Dave Long's avatar Dave Long
Browse files

Issue #3451611 by mfb, xjm, smustgrave, quietone: Fix the format=flowed;...

Issue #3451611 by mfb, xjm, smustgrave, quietone: Fix the format=flowed; delsp=yes encoding of email messages

(cherry picked from commit c29768f4)
parent e8d874f4
No related branches found
No related tags found
18 merge requests!10663Issue #3495778: Update phpdoc in FileSaveHtaccessLoggingTest,!10451Issue #3472458 by watergate, smustgrave: CKEditor 5 show blocks label is not translated,!103032838547 Fix punctuation rules for inline label suffix colon with CSS only,!10150Issue #3467294 by quietone, nod_, smustgrave, catch, longwave: Change string...,!10130Resolve #3480321 "Second level menu",!9936Issue #3483087: Check the module:// prefix in the translation server path and replace it with the actual module path,!9933Issue #3394728 by ankondrat4: Undefined array key "#prefix" and deprecated function: explode() in Drupal\file\Element\ManagedFile::uploadAjaxCallback(),!9914Issue #3451136 by quietone, gapple, ghost of drupal past: Improve...,!9882Draft: Issue #3481777 In bulk_form ensure the triggering element is the bulk_form button,!9839Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9815Issue #3480025: There is no way to remove entity cache items,!9757Issue #3478869 Add "All" or overview links to parent links,!9752Issue #3439910 by pooja_sharma, vensires: Fix Toolbar tests that rely on UID1's super user behavior,!9749Issue #3439910 by pooja_sharma, vensires: Fix Toolbar tests that rely on UID1's super user behavior,!9678Issue #3465132 by catch, Spokje, nod_: Show test run time by class in run-tests.sh output,!9578Issue #3304746 by scott_euser, casey, smustgrave: BigPipe cannot handle (GET)...,!9449Issue #3344041: Allow textarea widgets to be used for text (formatted) fields,!8945🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥...
Pipeline #231037 passed with warnings
Pipeline: drupal

#231053

    Pipeline: drupal

    #231048

      Pipeline: drupal

      #231042

        ...@@ -311,7 +311,7 @@ protected static function wrapMailLine(&$line, $key, $values) { ...@@ -311,7 +311,7 @@ protected static function wrapMailLine(&$line, $key, $values) {
        } }
        if (!$line_is_mime_header) { if (!$line_is_mime_header) {
        // Use soft-breaks only for purely quoted or un-indented text. // Use soft-breaks only for purely quoted or un-indented text.
        $line = wordwrap($line, 77 - $values['length'], $values['soft'] ? " \n" : "\n"); $line = wordwrap($line, 77 - $values['length'], $values['soft'] ? " \n" : "\n");
        } }
        // Break really long words at the maximum width allowed. // Break really long words at the maximum width allowed.
        $line = wordwrap($line, 996 - $values['length'], $values['soft'] ? " \n" : "\n", TRUE); $line = wordwrap($line, 996 - $values['length'], $values['soft'] ? " \n" : "\n", TRUE);
        ......
        ...@@ -64,10 +64,8 @@ public function format(array $message) { ...@@ -64,10 +64,8 @@ public function format(array $message) {
        // Join the body array into one string. // Join the body array into one string.
        $message['body'] = implode("\n\n", $message['body']); $message['body'] = implode("\n\n", $message['body']);
        // Convert any HTML to plain-text. // Convert any HTML to plain text (which also wraps the mail body).
        $message['body'] = MailFormatHelper::htmlToText($message['body']); $message['body'] = MailFormatHelper::htmlToText($message['body']);
        // Wrap the mail body for sending.
        $message['body'] = MailFormatHelper::wrapMail($message['body']);
        return $message; return $message;
        } }
        ......
        ...@@ -98,11 +98,14 @@ public function __construct( ...@@ -98,11 +98,14 @@ public function __construct(
        } }
        public function format(array $message) { public function format(array $message) {
        // Convert any HTML to plain-text.
        foreach ($message['body'] as &$part) { foreach ($message['body'] as &$part) {
        // If the message contains HTML, convert it to plain text (which also
        // wraps the mail body).
        if ($part instanceof MarkupInterface) { if ($part instanceof MarkupInterface) {
        $part = MailFormatHelper::htmlToText($part); $part = MailFormatHelper::htmlToText($part);
        } }
        // If the message does not contain HTML, it still needs to be wrapped
        // properly.
        else { else {
        $part = MailFormatHelper::wrapMail($part); $part = MailFormatHelper::wrapMail($part);
        } }
        ......
        ...@@ -32,8 +32,11 @@ public function testWrapMail(): void { ...@@ -32,8 +32,11 @@ public function testWrapMail(): void {
        // Check that the body headers were not wrapped even though some exceeded // Check that the body headers were not wrapped even though some exceeded
        // 77 characters. // 77 characters.
        $this->assertEquals($headers_in_body, $processed_headers, 'Headers in the body are not wrapped.'); $this->assertEquals($headers_in_body, $processed_headers, 'Headers in the body are not wrapped.');
        // Check that the body text is wrapped. // Check that the body text is soft-wrapped according to the
        $this->assertEquals(wordwrap($body, 77, " \n"), $processed_body, 'Body text is wrapped.'); // "format=flowed; delsp=yes" encoding. When interpreting this encoding,
        // mail readers will delete a space at the end of the line; therefore an
        // extra trailing space should be present in the raw body (see RFC 3676).
        $this->assertEquals(wordwrap($body, 77, " \n"), $processed_body, 'Body text is soft-wrapped.');
        } }
        } }
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment