Bug #8062: Fix link parsing
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 10 Mar 2009 22:30:47 +0000 (16:30 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 10 Mar 2009 22:30:47 +0000 (16:30 -0600)
We need to make sure there is a space before target/href or else params
contained in a URL can confuse the regexp if named target or href.

imp/lib/Mime/Viewer/Html.php

index 69000c6..bb0801d 100644 (file)
@@ -170,11 +170,11 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html
          * mailto: links, links that have an "#xyz" anchor and ignore
          * all links that already have a target. */
         $data = preg_replace(
-            array('/<a\s([^>]*\s*href=["\']?(#|mailto:))/i',
-                  '/<a\s([^>]*)\s*target=["\']?[^>"\'\s]*["\']?/i',
+            array('/<a\s([^>]*\s+href=["\']?(#|mailto:))/i',
+                  '/<a\s([^>]*)\s+target=["\']?[^>"\'\s]*["\']?/i',
                   '/<a\s/i',
-                  '/<area\s([^>]*\s*href=["\']?(#|mailto:))/i',
-                  '/<area\s([^>]*)\s*target=["\']?[^>"\'\s]*["\']?/i',
+                  '/<area\s([^>]*\s+href=["\']?(#|mailto:))/i',
+                  '/<area\s([^>]*)\s+target=["\']?[^>"\'\s]*["\']?/i',
                   '/<area\s/i',
                   "/\x01/",
                   "/\x02/"),