talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 967a512bbcf98c5206bd8992f00a0de509174c0b
parent e6e769570534a85a35a5201ffa0b74149904539c
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Wed, 11 Nov 2015 21:42:16 +0100

Do not add mailto: prefix for URIs with protocol part.

Closes bug #3562.

Diffstat:
Msrc/common/utils.c | 15+++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/common/utils.c b/src/common/utils.c @@ -4525,10 +4525,21 @@ gchar *make_email_string(const gchar *bp, const gchar *ep) * uri type later on in the button_pressed signal handler */ gchar *tmp; gchar *result; + gchar *colon, *at; tmp = g_strndup(bp, ep - bp); - result = g_strconcat("mailto:", tmp, NULL); - g_free(tmp); + + /* If there is a colon in the username part of the address, + * we're dealing with an URI for some other protocol - do + * not prefix with mailto: in such case. */ + colon = strchr(tmp, ':'); + at = strchr(tmp, '@'); + if (colon != NULL && at != NULL && colon < at) { + result = tmp; + } else { + result = g_strconcat("mailto:", tmp, NULL); + g_free(tmp); + } return result; }