[PHP-WEBMASTER] [web-news] master: Fix bug in handling of HTML messages

Author: Jim Winstead (jimwins)
Date: 2024-09-02T13:09:28-07:00

Commit: Fix bug in handling of HTML messages · php/web-news@0e68ca6 · GitHub
Raw diff: https://github.com/php/web-news/commit/0e68ca6e459f5779a62fd8edd513912a43f2fc95.diff

Fix bug in handling of HTML messages

Changed paths:
  M article.php

Diff:

diff --git a/article.php b/article.php
index a617e58..d944049 100644
--- a/article.php
+++ b/article.php
@@ -133,7 +133,7 @@
         // This makes HTML from Fastmail retain paragraph breaks
         $text = preg_replace('#<div><br></div>#', "\n\n", $mail['html']);
         // And this avoids extra linebreaks from another example (Android?)
- $text = preg_replace("#\n<br>\n#", "\n", $mail['html']);
+ $text = preg_replace("#\n<br>\n#", "\n", $text);
         $mail['text'] = html_entity_decode(strip_tags($text), encoding: 'UTF-8');
     } else {
         $mail['text'] = "> There was no text content in this message.";