View Issue Details

IDProjectCategoryView StatusLast Update
0003055SOGoActiveSyncpublic2015-02-11 23:15
Reportertommie Assigned Toludovic  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platform[Client] GoogleOSAndroidOS VersionKit Kat
Product Version2.2.13 
Fixed in Version2.2.16 
Summary0003055: Plain/Text mails are missing carriage returns on android
Description

Mails that are sent as plain/text, are received as a one line message. The message is missing carriage returns.

This is also reproducible on Android 5.

Steps To Reproduce

-Sent a plain/text mail to a SOGo mailbox.
-Sync the mail through activesync
-mail is received, but carriage returns are missing.

TagsNo tags attached.

Activities

heupink

heupink

2015-01-07 09:52

reporter   ~0008014

I'm on a jolla/sailfish phone, and have noticed this as well. (also on 2.2.13)

ludovic

ludovic

2015-01-09 15:54

administrator   ~0008036

It works for me.

Please attach an EML version of a message exposing the problem.

tommie

tommie

2015-01-10 13:59

reporter  

Test.eml (1,185 bytes)
tommie

tommie

2015-01-10 14:00

reporter  

tommie

tommie

2015-01-10 14:01

reporter   ~0008049

Hi,

I have just created a small test mail. Which looks fine in SOGo webinterface and thunderbird, but is missing carriage returns in the android mail client.

It happens with EVERY plain/text mail.

Thanks for looking into this.

ludovic

ludovic

2015-01-12 19:44

administrator   ~0008056

It works for me on Android 4.4 with your mail above.

It also works with the same mail in Outlook 2013.

tommie

tommie

2015-01-12 19:56

reporter   ~0008058

I use Cyagenmod 11, maybe the problem is in the mail client there?

ludovic

ludovic

2015-01-12 19:57

administrator   ~0008059

Perhaps, ask them!

McMichaeli

McMichaeli

2015-01-13 10:13

reporter   ~0008063

I have a vanilla Nexus 5 running the plain Google Android 5.0.1 release. It now uses GMail as its ActiveSync mail client and experiences the same problem with line endings that tommie reports.

My hunch is that it's a Windows/Linux CR/LF issue somewhere.

McMichaeli

McMichaeli

2015-02-07 13:45

reporter   ~0008152

Tested against 2.2.15 with Android 5.0.1 on a Nexus 5 and no improvement is seen. All body text is rendered as a single line.

buzzzo

buzzzo

2015-02-09 04:44

reporter   ~0008155

Last edited: 2015-02-10 09:56

I can confirm the problem.
On nexus 5 kk 4.4 and nexus 7 kk 4.4

tfu

tfu

2015-02-11 07:45

reporter  

3055.diff (1,565 bytes)   
diff --git a/ActiveSync/SOGoMailObject+ActiveSync.m b/ActiveSync/SOGoMailObject+ActiveSync.m
index e7797df..a1b8c84 100644
--- a/ActiveSync/SOGoMailObject+ActiveSync.m
+++ b/ActiveSync/SOGoMailObject+ActiveSync.m
@@ -227,6 +227,10 @@ struct GlobalObjectId {
       type = [part valueForKey: @"type"];
       subtype = [part valueForKey: @"subtype"];
       
+      // Don't select an attachment as body
+      if ([[[part valueForKey: @"disposition"] valueForKey: @"type"] isEqualToString: @"attachment"])
+         continue;
+
       if ([type isEqualToString: @"text"] && [subtype isEqualToString: @"html"])
         htmlKey = key;
       else if ([type isEqualToString: @"text"] && [subtype isEqualToString: @"plain"])
@@ -439,7 +443,7 @@ struct GlobalObjectId {
             {
               s = [s htmlToText];
             }
-          
+
           d = [s dataUsingEncoding: NSUTF8StringEncoding];
         }
       else if ([type isEqualToString: @"multipart"])
@@ -734,7 +738,13 @@ struct GlobalObjectId {
       len = [content length];
       
       [s appendString: @"<Body xmlns=\"AirSyncBase:\">"];
-      [s appendFormat: @"<Type>%d</Type>", preferredBodyType];
+
+      // Set the correct type if client requested text/html but we got text/plain
+      if (preferredBodyType == 2 && nativeBodyType == 1)
+         [s appendString: @"<Type>1</Type>"];
+      else
+         [s appendFormat: @"<Type>%d</Type>", preferredBodyType];
+
       [s appendFormat: @"<Truncated>%d</Truncated>", truncated];
       [s appendFormat: @"<Preview></Preview>"];
 
3055.diff (1,565 bytes)   
tfu

tfu

2015-02-11 07:47

reporter   ~0008166

Last edited: 2015-02-11 09:30

If you are in the position to test a fix try the attached patch.

McMichaeli

McMichaeli

2015-02-11 13:19

reporter   ~0008167

The patch looks promising and might even cause the Android mail clients to display the content in a fixed pitch font.

Will it be included in the nightlies or so I need to apply it to the source and build it? I can test nightlies but I'm not going to be in a situation to build from source for a couple of weeks due to other pressing projects...

ludovic

ludovic

2015-02-11 13:32

administrator   ~0008168

I've pushed the patch:

https://github.com/inverse-inc/sogo/commit/82178fd6ceb5c4cb9acb10a4be06c022c895de7a

If you tell me which distro you're using, I can regenerate a build which will be available in 1 hour so you can test.

McMichaeli

McMichaeli

2015-02-11 14:12

reporter   ~0008169

Thanks. I'm using Ubuntu 14.04 LTS (Trusty Tahr) 64-bit (amd64) on our server. Let me know once the build completes and I'll pull the packages and give it a test?

ludovic

ludovic

2015-02-11 14:27

administrator   ~0008170

It's ready.

McMichaeli

McMichaeli

2015-02-11 14:52

reporter   ~0008171

That was quick! OK, I've installed sogo-activesync (2.2.15.20150211-1) and restarted all the sogo workers on the system. I issued a "sogo-tool manage-eas resetfolder <id>" command against three folders containing plain text messages, which seemed to correctly clear the folder in GMail on my Nexus 5 (Android 5.0.1) and reload the messages.

It's mostly excellent news. Just about all of my plain text messages now wrap correctly. GMail sadly doesn't select a fixed pitch font but that's not your problem to fix!

I have two messages that still do not appear to work. One has no body content at all (just headers) and the other is still rendered on a single line. I'm about to upload copies of them to this but with the sensitive information removed.

Hope this helps?

ludovic

ludovic

2015-02-11 14:54

administrator   ~0008172

Send them to Thomas Fuehrer and myself - you can grab our emails in the mailing list.

McMichaeli

McMichaeli

2015-02-11 15:03

reporter  

McMichaeli

McMichaeli

2015-02-11 15:03

reporter  

McMichaeli

McMichaeli

2015-02-11 15:08

reporter   ~0008173

Didn't refresh the page before uploading, so they're attached to this bug and I have also e-mailed them to you as requested...

McMichaeli

McMichaeli

2015-02-11 15:18

reporter   ~0008174

Sorry to mess you around! I've just done a complete DeviceReset and now the message that rendered with no carriage returns is fine. Obviously something was caching the old copy somewhere.

The blank message is still blank though and has no body at all.

ludovic

ludovic

2015-02-11 16:26

administrator   ~0008175

The black message is probably due to the fact that it has no content-type.

tfu

tfu

2015-02-11 16:41

reporter   ~0008176

The problem is caused by an invalid us-ascii character

... from sogo.log: Got invalid multibyte sequence. ToEncode: UCS-2LE FromEncode: US-ASCII.

The "invalid" character is in this string: fee of œ90 + VAT.

ludovic

ludovic

2015-02-11 23:15

administrator   ~0008177

Fix from tfu works and has been pushed.

Open an other bug for the other issue.

Issue History

Date Modified Username Field Change
2015-01-06 13:01 tommie New Issue
2015-01-07 09:52 heupink Note Added: 0008014
2015-01-09 15:54 ludovic Note Added: 0008036
2015-01-09 15:54 ludovic Severity major => minor
2015-01-10 13:59 tommie File Added: Test.eml
2015-01-10 14:00 tommie File Added: Screenshot_2015-01-10-14-57-26.png
2015-01-10 14:01 tommie Note Added: 0008049
2015-01-12 19:44 ludovic Note Added: 0008056
2015-01-12 19:56 tommie Note Added: 0008058
2015-01-12 19:57 ludovic Note Added: 0008059
2015-01-13 10:13 McMichaeli Note Added: 0008063
2015-02-07 13:45 McMichaeli Note Added: 0008152
2015-02-09 04:44 buzzzo Note Added: 0008155
2015-02-10 09:56 buzzzo Note Edited: 0008155
2015-02-11 07:45 tfu File Added: 3055.diff
2015-02-11 07:47 tfu Note Added: 0008166
2015-02-11 09:30 tfu Note Edited: 0008166
2015-02-11 13:19 McMichaeli Note Added: 0008167
2015-02-11 13:32 ludovic Note Added: 0008168
2015-02-11 14:12 McMichaeli Note Added: 0008169
2015-02-11 14:27 ludovic Note Added: 0008170
2015-02-11 14:52 McMichaeli Note Added: 0008171
2015-02-11 14:54 ludovic Note Added: 0008172
2015-02-11 15:03 McMichaeli File Added: 2.2.15.20150211-1 Blank Body.eml
2015-02-11 15:03 McMichaeli File Added: 2.2.15.20150211-1 Single Line Body.eml
2015-02-11 15:08 McMichaeli Note Added: 0008173
2015-02-11 15:18 McMichaeli Note Added: 0008174
2015-02-11 16:26 ludovic Note Added: 0008175
2015-02-11 16:41 tfu Note Added: 0008176
2015-02-11 23:15 ludovic Note Added: 0008177
2015-02-11 23:15 ludovic Status new => resolved
2015-02-11 23:15 ludovic Fixed in Version => 2.2.16
2015-02-11 23:15 ludovic Resolution open => fixed
2015-02-11 23:15 ludovic Assigned To => ludovic