From 8cded096213b17887fbb0aa226efa09cb0d803ef Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 28 Aug 2015 03:17:44 -0400
Subject: [PATCH] Fix handling of plus character in mailto: links (#1490510)

---
 CHANGELOG                      |    1 +
 program/steps/mail/compose.inc |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index f7a0c01..607224d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@
 - Fix SQL error on logout when using session_storage=php (#1490421)
 - Fix so plain text signature field uses monospace font (#1490435)
 - Fix draft removal after a message is sent and storing sent message is disabled (#1490467)
+- Fix handling of plus character in mailto: links (#1490510)
 
 RELEASE 1.0.6
 -------------
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index d721482..bd0b11a 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -431,7 +431,8 @@
         // #1486037: remove "mailto:" prefix
         $COMPOSE['param']['to'] = preg_replace('/^mailto:/i', '', $mailto[0]);
         // #1490346: decode the recipient address
-        $COMPOSE['param']['to'] = urldecode($COMPOSE['param']['to']);
+        // #1490510: use raw encoding for correct "+" character handling as specified in RFC6068
+        $COMPOSE['param']['to'] = rawurldecode($COMPOSE['param']['to']);
 
         // Supported case-insensitive tokens in mailto URL
         $url_tokens = array('to', 'cc', 'bcc', 'reply-to', 'in-reply-to', 'references', 'subject', 'body');

--
Gitblit v1.9.1