Bug 363586 - Kmail2 handles mailto: incorrectly. urlencoded does not work
Summary: Kmail2 handles mailto: incorrectly. urlencoded does not work
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: commands and actions (show other bugs)
Version: unspecified
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-27 10:11 UTC by eduard
Modified: 2016-07-30 13:27 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.3.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description eduard 2016-05-27 10:11:14 UTC
I used to create emails with attached files using mailto: and kmail, but latter versions did stop working properly.

The standard way to work is to urlencode the mailto link so kmail decodes it and creates the message.
Now kmail2 does not accept the urlencoded link. TO, CC fields get mixed up. And if you send the code urldecoded then line breaks are not printed correctly.

Example:

What should work
<a href=
"mailto:SOMEONE%20%3Csomeonesmail%40email.com%3E?cc=someothermail@othermail.com,YETANOTHER20%3Cyetanothermail%40yetanothermail.com%3E&amp;subject=a%20subject%20here%202016&amp;body=Dear%20Al%C3%ADcia%2C%0A%0ABlahAdjuntem%20factura%20n%C3%BAm%203043%20de%20Bredax.%0A%0ASalutacions%2C%0A&amp;attachment=/somefile.pdf" link should work and
/>Urlencoded Correct email</a>
<a href=
"mailto:SOMEONE <someonesmail@email.com>?cc=someothermail@othermail.com,YETANOTHER<yetanothermail@yetanothermail.com>&amp;subject=a subject here 2016&amp;body=Dear Alícia,
BlahAdjuntem factura núm 3043 de Bredax.

Salutacions,
&amp;attachment=/somefile.pdf"
/>Urldecoded incorrect mail</a>

The second one is the one that kind of works, yet line breaks are not interpreted correctly.

Reproducible: Always

Steps to Reproduce:
1. Test the links I send you
2. You'll see the first does not compose correcly and the second do not have line breaks.


Actual Results:  
2. You'll see the first does not compose correcly and the second do not have line breaks.


Expected Results:  
The first link should generate correct email with TO, 2 CC fields, body attachment and properly formated body.

I am using firefox from last Ubuntu 16.04
Comment 1 Dominik George 2016-07-28 21:46:00 UTC
Tracked in Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=832795

I can confirm that handling mailto: links are broken.

As of one of the last updates, using mailto: links with KMail is broken.
mailto: URIs passed by any web browser (tested with Firefox and
Konqueror) are not properly unescaped, and URI entities like %0A end up
in the mail. Firefox even quotes colons in the subject and these also
end up escaped in the subject line (e.g. when clicking the reply link in
the Debian BTS).
Comment 2 Laurent Montel 2016-07-29 04:55:54 UTC
Please provide a mail (as mbox) which has this bug please.
Thanks
Comment 3 Dominik George 2016-07-29 11:42:58 UTC
(In reply to Laurent Montel from comment #2)
> Please provide a mail (as mbox) which has this bug please.
> Thanks

Sorry, that request does not make any sense to me. Please read the bug report again.
Comment 4 Laurent Montel 2016-07-29 15:16:10 UTC
Ok so sorry if you can't provide a test case I will not lose my time against it.
That's all.
I don't have a lot of time to debug/test/fix etc. so if you don't want to help me it so I will not lose my time against this bug.
I am more bugs to fix.
Regards.
Comment 5 Dominik George 2016-07-29 15:19:48 UTC
(In reply to Laurent Montel from comment #4)
> Ok so sorry if you can't provide a test case I will not lose my time against
> it.
> That's all.
> I don't have a lot of time to debug/test/fix etc. so if you don't want to
> help me it so I will not lose my time against this bug.
> I am more bugs to fix.
> Regards.

Well, this bug simply is *not* about opening a specific mail inside KMail, but about *composing* a new one from a mailto: link, e.g. when called from a web browser. There simply *is no* mail anyone could provide as mbox, because the bug is not about displaying mail.

Test cases for the mailto: feature have already been posted in the initial bug report.
Comment 6 Dominik George 2016-07-29 15:23:40 UTC
> Test cases for the mailto: feature have already been posted in the initial
> bug report.

You can find several millions of other test cases at http://bugs.debian.org - simply choose a random bug report and click a random „reply“ link.
Comment 7 Laurent Montel 2016-07-30 13:14:55 UTC
Git commit 2ee5bc147480baf205611d333fe68233f9e1aa47 by Montel Laurent.
Committed on 30/07/2016 at 13:14.
Pushed by mlaurent into branch 'Applications/16.08'.

Convert %0A to \n

M  +1    -1    messagecore/autotests/stringutiltest.cpp
M  +6    -0    messagecore/src/utils/stringutil.cpp

http://commits.kde.org/messagelib/2ee5bc147480baf205611d333fe68233f9e1aa47
Comment 8 Laurent Montel 2016-07-30 13:20:58 UTC
Git commit b5411e67a29e2e74c14f7663922f672a916968c5 by Montel Laurent.
Committed on 30/07/2016 at 13:20.
Pushed by mlaurent into branch 'Applications/16.08'.

Fix Bug 363586 - Kmail2 handles mailto: incorrectly. urlencoded does not work

FIXED-IN: 5.3.0

M  +2    -1    kmail/src/kmkernel.cpp

http://commits.kde.org/kdepim/b5411e67a29e2e74c14f7663922f672a916968c5
Comment 9 Dominik George 2016-07-30 13:24:45 UTC
Hi,

sorry, I do not think this patch is complete. In fact, I think it is just a new bug.

Your patch simply replaces all %0A with \n in the body. In fact, the body needs to be passed through decodeMailtoUrl() or something like that just like the to= query parameter is.

Moreover, the same applies to subject=, and *any* other field.

(On a side note, the %xx encoding has nothing to do with HTML, it is URI encoding).

You can use any mail in the Debian bug tracker and click the reply link to test whether the fix is complete.

-nik
Comment 10 Dominik George 2016-07-30 13:27:49 UTC
Hi,

my last comment actually came in between your two commits.

I think the second commit might actually fix the bug.

Thanks ☺!