From 968320563368f9b8eecaf3fb20ade38d66c92fdb Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 16 Dec 2014 12:26:41 -0600
Subject: [PATCH] html2text: Avoid long, wrapped URLs in a tags

---
 include/html2text.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/html2text.php b/include/html2text.php
index 0c1ec0833..1d12c733c 100644
--- a/include/html2text.php
+++ b/include/html2text.php
@@ -448,6 +448,11 @@ class HtmlAElement extends HtmlInlineElement {
             $href = substr($href, 7);
             $output = (($href != $output) ? "$href " : '') . "<$output>";
         } elseif (mb_strwidth($href) > $width / 2) {
+            if (mb_strwidth($output) > $width / 2) {
+                // Parse URL and use relative path part
+                if ($PU = parse_url($output))
+                    $output = $PU['host'] . $PU['path'];
+            }
             if ($href != $output)
                 $id = $this->getRoot()->addFootnote($output, $href);
             $output = "[$output][$id]";
-- 
GitLab