Bug 332368

Summary: Passing a PGP message via KToolInvocation::invokeMailer() it will not show up in the composer
Product: [Applications] kmail2 Reporter: Rolf Eike Beer <kde>
Component: cryptoAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: florbo45, montel, toralf.foerster
Priority: NOR    
Version: 5.19.1   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 5.19.2
Sentry Crash Report:

Description Rolf Eike Beer 2014-03-20 17:28:51 UTC
To test use the current HEAD of KDE/4.12, KDE/4.13, or master branch in kde:kgpg repository. The email composer will show up empty (or only with your signature). If you open the file caff.cpp and change the last argument to KToolInvocation::invokeMailer() from text to "test.mid(1)" or "text.mid(0).insert(0, QLatin1Char(' '))" then the text will show up in the composer.

Reproducible: Always
Comment 1 Toralf Förster 2014-03-20 18:12:44 UTC
Maybe here's another instance of this: see bug 332364 ?
Comment 2 Rolf Eike Beer 2014-03-20 20:43:57 UTC
No, that one doesn't use that code path. Also that one seems to hang in an endless loop, while this one behaves properly (it just ignores the data).
Comment 3 Denis Kurz 2016-09-24 18:24:18 UTC
This bug has only been reported for versions before 4.14, which have been unsupported for at least two years now. Can anyone tell if this bug still present?

If noone confirms this bug for a Framework-based version of kmail2 (version 5.0 or later, as part of KDE Applications 15.12 or later), it gets closed in about three months.
Comment 4 Rolf Eike Beer 2016-09-26 15:50:01 UTC
Still in 5.3.0
Comment 5 Rolf Eike Beer 2018-09-08 08:38:25 UTC
*** Bug 398224 has been marked as a duplicate of this bug. ***
Comment 6 florbo45 2018-09-11 10:36:34 UTC
It seems this is still a problem in KMail 5.8.3
Comment 7 Rolf Eike Beer 2022-01-20 09:53:51 UTC
Still happens in 5.19.1.
Comment 8 Laurent Montel 2022-01-20 09:57:53 UTC
Do you have a testcase how I can reproduce it ?
I think it(s from kgpg.
Comment 9 Rolf Eike Beer 2022-01-20 10:16:50 UTC
Open KGpg, select any key, press Ctrl-C and select "send by mail".
Comment 10 Laurent Montel 2022-01-20 12:25:09 UTC
Ok I can reproduce.
All code works but displaying not work as we have code in cryptohelper.cpp

which test if we have line as -----BEGIN and it thinks that it's a signature...

=> it will not displaying it.

For the moment I don't have solution.
Comment 11 Rolf Eike Beer 2022-01-20 12:33:22 UTC
determineType() should identify it properly, maybe the caller just has wrong checks of the return code?

While looking at it prepareMessageForDecryption() just below is also a bit too aggressive when trying to find something to decrypt, maybe it should call out to a variant of determineType() and properly look on the return code?
Comment 12 Laurent Montel 2022-01-20 13:03:18 UTC
Git commit 43754e2876962e9db329eb72aa64d8b1babd7fb5 by Laurent Montel.
Committed on 20/01/2022 at 13:01.
Pushed by mlaurent into branch 'release/21.12'.

Fix Passing a PGP message via KToolInvocation::invokeMailer() it will not show up in the composer
FIXED-IN: 5.19.2

M  +6    -1    mimetreeparser/src/cryptohelper.cpp

https://invent.kde.org/pim/messagelib/commit/43754e2876962e9db329eb72aa64d8b1babd7fb5
Comment 13 Toralf Förster 2022-01-21 16:52:00 UTC
what's about bug 332364 ?