X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Furl_parser.php;h=b7c7ea5924200ded31c794638632dc44ec64026d;hb=f2ad47f19d5b71cca9d4d50095d0f9306d5e74cf;hp=3d82192c1cd904986245b5c094a8cf3ac61371d3;hpb=a6ec6dff8d3abb429557c8c0b6e30c50885afed3;p=squirrelmail.git diff --git a/functions/url_parser.php b/functions/url_parser.php index 3d82192c..b7c7ea59 100644 --- a/functions/url_parser.php +++ b/functions/url_parser.php @@ -6,7 +6,7 @@ * This code provides various string manipulation functions that are * used by the rest of the SquirrelMail code. * - * @copyright © 1999-2009 The SquirrelMail Project Team + * @copyright 1999-2010 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -146,9 +146,15 @@ function parseUrl (&$body) { if ((preg_match($MailTo_PReg_Match, $mailto, $regs)) && ($regs[0] != '')) { //sm_print_r($regs); $mailto_before = $target_token . $regs[0]; - $mailto_params = $regs[10]; + /** + * '+' characters in a mailto URI don't need to be percent-encoded. + * However, when mailto URI data is transported via HTTP, '+' must + * be percent-encoded as %2B so that when the HTTP data is + * percent-decoded, you get '+' back and not a space. + */ + $mailto_params = str_replace("+", "%2B", $regs[10]); if ($regs[1]) { //if there is an email addr before '?', we need to merge it with the params - $to = 'to=' . $regs[1]; + $to = 'to=' . str_replace("+", "%2B", $regs[1]); if (strpos($mailto_params, 'to=') > -1) //already a 'to=' $mailto_params = str_replace('to=', $to . '%2C%20', $mailto_params); else {