From 9317cdd2166ce1e5d8dc6ebfaed9f14d7c3d9c11 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 5 Jul 2018 11:28:12 +0200 Subject: [PATCH] Fix contacts with ampersands in their name will fail in mailto function --- api/js/jsapi/egw_open.js | 2 +- mail/inc/class.mail_compose.inc.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api/js/jsapi/egw_open.js b/api/js/jsapi/egw_open.js index 69dab42007..aa893f2175 100644 --- a/api/js/jsapi/egw_open.js +++ b/api/js/jsapi/egw_open.js @@ -45,7 +45,7 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) var hashes = uri.slice(uri.indexOf('?') + 1).split('&'); for(var i = 0; i < hashes.length; i++) { - index = hashes[i].split('='); + index = hashes[i].replace(/__AMPERSAND__/g, '&').split('='); match.push(index[0]); match[index[0]] = index[1]; } diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index e84be02aea..a670814ae6 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -865,11 +865,12 @@ class mail_compose $addRequests = explode('&',$mailtoArray[1]); foreach ($addRequests as $key => $reqval) { // the additional requests should have a =, to separate key from value. + $reqval = preg_replace('/__AMPERSAND__/i', "&", $reqval); $keyValuePair = explode('=',$reqval,2); $content[$keyValuePair[0]] .= (strlen($content[$keyValuePair[0]])>0 ? ' ':'') . $keyValuePair[1]; } } - $content['to']=$mailtoArray[0]; + $content['to']= preg_replace('/__AMPERSAND__/i', "&", $mailtoArray[0]); $alreadyProcessed['to']='to'; // if the mailto string is not htmlentity decoded the arguments are passed as simple requests foreach(array('cc','bcc','subject','body') as $name) {