Fix mailto: processing for link tags with pre-existing target attribute
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 23 Jul 2010 22:46:00 +0000 (16:46 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 23 Jul 2010 22:46:00 +0000 (16:46 -0600)
imp/lib/Mime/Viewer/Html.php

index 69fe92e..489b807 100644 (file)
@@ -283,12 +283,12 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html
                 /* Convert links to open in new windows. Ignore
                  * mailto: links, links that have an "#xyz" anchor,
                  * and links that already have a target. */
-                if (!$node->hasAttribute('target') &&
-                    $node->hasAttribute('href')) {
+                if ($node->hasAttribute('href')) {
                     $url = parse_url($node->getAttribute('href'));
                     if (isset($url['scheme']) && ($url['scheme'] == 'mailto')) {
                         $node->setAttribute('href', IMP::composeLink($node->getAttribute('href')));
-                    } elseif (empty($url['fragment'])) {
+                    } elseif (!$node->hasAttribute('target') &&
+                              empty($url['fragment'])) {
                         $node->setAttribute('target', $this->_imptmp['target']);
                     }
                 }