Support newline variations for preserving linebreaks option

Created on 6 February 2024, 5 months ago
Updated 20 February 2024, 4 months ago

Problem/motivation

In ✨ Add option to preserve newlines and non-breaking spaces Fixed , this module added the ability to retain linebreaks, and included logic to specifically handle linebreak encoding for MS Outlook. However, the implementation only supported linebreaks of type \r\n.

It should also support linebreaks of type \n.

Proposed resolution

diff --git a/src/Plugin/DateAugmenter/AddToCal.php b/src/Plugin/DateAugmenter/AddToCal.php
index 1ced78f..4b148ca 100644
--- a/src/Plugin/DateAugmenter/AddToCal.php
+++ b/src/Plugin/DateAugmenter/AddToCal.php
@@ -251,6 +251,7 @@ class AddToCal extends DateAugmenterPluginBase implements PluginFormInterface, C
         // iCalendar linebreaks must be escaped per
         // https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.11.
         $description = str_replace("\r\n", "\\n", $description);
+        $description = str_replace("\n", "\\n", $description);
       }
       $ical_link[] = 'DESCRIPTION:' . rawurlencode($description);
     }
This module uses Gitlab CI for automated testing of proposed code changes. To contribute code changes, create a merge request. Patch files will not trigger automated testing and are not sufficient for review.
✨ Feature request
Status

Fixed

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mark_fullmer Tucson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024