From 430a70d63f47db220a18e5b07b663da3dd194b27 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Fri, 11 Oct 2013 18:44:05 +0000
Subject: [PATCH] Preserve whitespace on text emails

---
 include/class.format.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/class.format.php b/include/class.format.php
index 5be966780..7b80dc97b 100644
--- a/include/class.format.php
+++ b/include/class.format.php
@@ -142,10 +142,12 @@ class Format {
                 'safe' => 1, //Exclude applet, embed, iframe, object and script tags.
                 'balance' => 1, //balance and close unclosed tags.
                 'comment' => 1, //Remove html comments (OUTLOOK LOVE THEM)
-                'tidy' => -1, // Clean extra whitspace
                 'schemes' => 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; *:file, http, https; src: cid, http, https, data'
                 );
 
+        if (!preg_match('/style="[^"]*white-space:\s*pre/i', $html) !== false)
+            $config['tidy'] = -1; // Clean extra whitspace
+
         return Format::html($html, $config);
     }
 
-- 
GitLab