only add a closing quote if it is not already present
authorMichael McAndrew <michaelmcandrew@thirdsectordesign.org>
Tue, 22 May 2018 15:28:19 +0000 (16:28 +0100)
committerMichael McAndrew <michaelmcandrew@thirdsectordesign.org>
Tue, 22 May 2018 15:28:19 +0000 (16:28 +0100)
CRM/Mailing/BAO/Mailing.php

index 9e7c1ea53ab333ed4ea316f01393cfb779dfa59e..09983f45bfede941540b3419c60fd72196b6c489 100644 (file)
@@ -1342,10 +1342,10 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       }
       // add trailing quote since we've gobbled it up in a previous regex
       // function getPatterns, line 431
-      if (preg_match('/^href[ ]*=[ ]*\'/', $url)) {
+      if (preg_match("/^href[ ]*=[ ]*'.*[^']$/", $url)) {
         $url .= "'";
       }
-      elseif (preg_match('/^href[ ]*=[ ]*\"/', $url)) {
+      elseif (preg_match('/^href[ ]*=[ ]*".*[^"]$/', $url)) {
         $url .= '"';
       }
       $data = $url;