pgp encrypted message are mostly marked as application/octet-stream
ClosedPublic

Authored by knauss on Oct 30 2017, 11:23 AM.

Details

Summary

We can autodetect if, the content of an mimepart is pgp encrypted.
The problem at the moment, is that we display directly every
EncryptedMessagePart, what is okay for text content but not for
everything else.

BUG: 324365
FIXED-IN: 17.12.0

Test Plan

make sure , that attatchment are still handled as attachments and not as "normal" text.

Diff Detail

Repository
R94 PIM: Message Library
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
knauss created this revision.Oct 30 2017, 11:23 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptOct 30 2017, 11:23 AM
Restricted Application added a subscriber: KDE PIM. · View Herald Transcript

currently this patch restults with:

--- /home/neon/kdepim/src/kde/pim/messagelib/mimetreeparser/autotests/data/openpgp-inline-encrypted-with-attachment.mbox.tree   2017-10-30 11:13:47.986867617 +0000
+++ openpgp-inline-encrypted-with-attachment.mbox.out.tree      2017-10-30 11:14:42.058920933 +0000
@@ -3,5 +3,6 @@
    * MimeTreeParser::TextMessagePart
     * MimeTreeParser::EncryptedMessagePart
      * MimeTreeParser::SignedMessagePart
-   * MimeTreeParser::AttachmentMessagePart
-    * MimeTreeParser::MessagePart
+   * MimeTreeParser::EncryptedMessagePart
+    * MimeTreeParser::TextMessagePart <-- here MimeTreeParser::AttachmentMessagePart would be correct
+     * MimeTreeParser::MessagePart
FAIL!  : RenderTest::testRenderSmart(openpgp-inline-encrypted-with-attachment.mbox) Compared values are not the same
   Actual   (proc.exitCode()): 1
   Expected (0)              : 0
   Loc: [/home/neon/kdepim/src/kde/pim/messagelib/messageviewer/src/messagepartthemes/default/autotests/rendertest.cpp(295)]
--- /home/neon/kdepim/src/kde/pim/messagelib/mimetreeparser/autotests/data/openpgp-inline-encrypted-with-attachment.mbox.html   2017-10-30 11:13:37.482856527 +0000
+++ openpgp-inline-encrypted-with-attachment.mbox.out.html      2017-10-30 11:14:42.066920940 +0000
@@ -51,11 +51,31 @@
         </div>
         <a name="att2"/>
         <div id="attachmentDiv2">
-          <hr/>
-          <div>
-            <a href="attachment:2?place=body"><img align="center" height="48" width="48" src="file:text-plain.svg" border="0" style="max-width: 100%" alt=""/>attachment.asc</a>
-          </div>
-          <div/>
+          <table cellspacing="1" cellpadding="1" class="encr">
+            <tr class="encrH">
+              <td dir="ltr">
+                <div class="enc-simple">Encrypted message<a href="kmail:showEncryptionDetails" style="display:block;float:right;">Show Details</a></div>
+                <div class="enc-details" style="display:none;">The message is encrypted for the following keys:<a href="kmail:hideEncryptionDetails" style="display:block;float:right;">Hide Details</a><ul style="list-style-type: none;"><li>unittest key (no password) &lt;test@kolab.org&gt; (<a href="kmail:showCertificate#gpg ### OpenPGP ### 8D9860C58F246DE6">0x8D9860C58F246DE6</a>)</li></ul></div>
+              </td>
+            </tr>
+            <tr class="encrB">
+              <td>
+                <div style="position: relative; word-wrap: break-word">
+                  <a name="att"/>
+                  <div id="attachmentDiv">
+                    <div class="noquote">
+                      <div dir="ltr">asfsadfsdaf</div>
+                      <br/>
+                      <div dir="ltr">asdfasdfasdf</div>
+                    </div>
+                  </div>
+                </div>
+              </td>
+            </tr>
+            <tr class="encrH">
+              <td dir="ltr">End of encrypted message</td>
+            </tr>
+          </table>
         </div>
       </div>
     </div>
FAIL!  : RenderTest::testRenderSmart(openpgp-inline-encrypted-with-attachment.mbox) Compared values are not the same
   Actual   (proc.exitCode()): 1
   Expected (0)              : 0
knauss updated this revision to Diff 22499.Nov 17 2017, 1:01 AM

update patch to work like expected (mostly).

I'm a little bit unhappy about the display for iconic and hidden attachment style.
Also the attachment file name should be "smarter" like remove pgp at the end etc.

@vkrause: IMO it is ready for release- it is not perfect, but for smarter attachment control we need to rework the attachmentstrategy to know extracontent etc.

vkrause accepted this revision.Nov 18 2017, 11:32 AM
This revision is now accepted and ready to land.Nov 18 2017, 11:32 AM
This revision was automatically updated to reflect the committed changes.