jobisoft / EAS-4-TbSync

[Thunderbird Add-On] The Exchange ActiveSync provider for TbSync to sync contacts, tasks and calendars to Thunderbird.
https://github.com/jobisoft/EAS-4-TbSync/wiki/About:-Provider-for-Exchange-ActiveSync
Mozilla Public License 2.0
197 stars 28 forks source link

Arbitrary title/suffix value after sending email (EAS/mailcow) #148

Closed marek-cerny closed 2 years ago

marek-cerny commented 3 years ago

Your environment

TbSync version: 2.21 EAS-4-TbSync version: 1.20 Thunderbird version: 78.9.0

[X] Yes, I have installed the latest available beta version from https://tbsync.jobisoft.de and my issue is not yet fixed, I can still reproduce it.

Expected behavior

Contacts remains intact.

Actual behavior

After seding email to a person from an sogo/exchange address book synchronized via TbSync, the contact gets updated by arbitrary "[object Object]" values in Title and Suffix fields.

Steps to reproduce

Use Thunderbird/EAS-4-TbSync to synchronize address book from a mailcow: dockerized mail suite (current version from master). Write a new mail, choose a contact from the address book. View TbSync log and observe that contact gets updated by arbitrary "[object Object]" values in Title and Suffix fields.

** Fri Mar 26 2021 09:15:31 GMT+0100 (Central European Standard Time) **
[XML: Sending data <send.request.localchanges> for kontakty@oubrecht.net (Personal Address Book)] : 
<?xml version="1.0"?>
<Sync xmlns='AirSync'>
<Collections>
<Collection>
<SyncKey>1616746179</SyncKey>
<CollectionId>vcard%252Fpersonal</CollectionId>
<Commands>
<Change>
<ServerId>291eed41-a71f-4b63-81b2-11bc99e35e6e.vcf</ServerId>
<ApplicationData>
<FileAs xmlns='Contacts'>Ji%C5%99%C3%AD%20Ju%C5%99ena</FileAs>
<FirstName xmlns='Contacts'>Ji%C5%99%C3%AD</FirstName>
<LastName xmlns='Contacts'>Ju%C5%99ena</LastName>
<Email1Address xmlns='Contacts'>--redacted--</Email1Address>
<MobilePhoneNumber xmlns='Contacts'>--redacted--</MobilePhoneNumber>
<CompanyName xmlns='Contacts'>Oubrecht</CompanyName>
<Picture xmlns='Contacts'/>
<Suffix xmlns='Contacts'>%5Bobject%20Object%5D</Suffix>
<Title xmlns='Contacts'>%5Bobject%20Object%5D</Title>
<Body xmlns='AirSyncBase'>
<Type xmlns='AirSyncBase'>1</Type>
<EstimatedDataSize xmlns='AirSyncBase'>0</EstimatedDataSize>
<Data xmlns='AirSyncBase'/>
</Body>
</ApplicationData>
</Change>
</Commands>
</Collection>
</Collections>
</Sync>

Full log sent via email.

jobisoft commented 3 years ago

Cannot confirm that on TB 78.9.0 :-(

mlq commented 3 years ago

I can confirm the same issue. Do you only us TBSync for synchronization or any other client as well? Android?

marek-cerny commented 3 years ago

Yes, we have other clients connected to the same mailserver - mainly smartphones (Apple, Android) apart from other TB instances on PCs.

The thing is that Thunderbird UI does not display these attributes (title, suffix), so it doesn't know/show that the contacts get corrupted. The problem arises on mobile devices where contacts then appear as "[object Object] John Doe [object Object]" in the address book.

marek-cerny commented 3 years ago

Alright. I went ahead and did some more testing.

I've installed a brand new mailcow server (current stable @ Debian 11) with an unused domain. Then I've created a single user mailbox and connected it to:

  1. Fresh Thunderbird (91.3.1) with TbSync (3.0.1) using Provider for Exchange ActiveSync (2.0.1)
  2. Appe iPhone 8 (iOS 15.1) as an Exchange account

I was able to reproduce the issue above and narrow it down that it is indeed related to the Apple device. This is what happens.

  1. Ïn Thunderbird, I've created a simple contact entry. TbSync pushes it to the server and it looks like this:

    [XML: Sending data <send.request.localchanges> for marek@dokonalestavby.cz (Osobní kontakty)] : 
    <?xml version="1.0"?>
    <Sync xmlns='AirSync'>
    <Collections>
    <Collection>
    <SyncKey>1636983821</SyncKey>
    <CollectionId>vcard%252Fpersonal</CollectionId>
    <Commands>
    <Add>
    <ClientId>1637061413768-0</ClientId>
    <ApplicationData>
    <FileAs xmlns='Contacts'>Example%20User</FileAs>
    <FirstName xmlns='Contacts'>Example</FirstName>
    <LastName xmlns='Contacts'>User</LastName>
    <Email1Address xmlns='Contacts'>user%40example.org</Email1Address>
    <Picture xmlns='Contacts'/>
    <Body xmlns='AirSyncBase'>
    <Type xmlns='AirSyncBase'>1</Type>
    <EstimatedDataSize xmlns='AirSyncBase'>0</EstimatedDataSize>
    <Data xmlns='AirSyncBase'/>
    </Body>
    </ApplicationData>
    </Add>
    </Commands>
    </Collection>
    </Collections>
    </Sync>
  2. iPhone receives the updated contact list. Once I've made a minor change to the contact entry (in the example below, a phone number is added), TbSync receives updated entry that now contains empty Title and Suffix fields:

    [XML: Receiving data <send.request.remotechanges> for marek@dokonalestavby.cz (Osobní kontakty)] : 
    <?xml version="1.0"?>
    <Sync xmlns='AirSync'>
    <Collections>
    <Collection>
    <Class>Contacts</Class>
    <SyncKey>1637061856</SyncKey>
    <CollectionId>vcard%252Fpersonal</CollectionId>
    <Status>1</Status>
    <Commands>
    <Change>
    <ServerId>48-61939300-1-27DA3700.vcf</ServerId>
    <ApplicationData>
    <LastName xmlns='Contacts'>User</LastName>
    <FirstName xmlns='Contacts'>Example</FirstName>
    <MiddleName xmlns='Contacts'/>
    <Title xmlns='Contacts'/>
    <Suffix xmlns='Contacts'/>
    <FileAs xmlns='Contacts'>Example%20User</FileAs>
    <Department xmlns='Contacts'/>
    <IMAddress xmlns='Contacts2'/>
    <NickName xmlns='Contacts2'/>
    <JobTitle xmlns='Contacts'/>
    <Email1Address xmlns='Contacts'>user%40example.org</Email1Address>
    <MobilePhoneNumber xmlns='Contacts'>123%20456%20789</MobilePhoneNumber>
    <Body xmlns='AirSyncBase'>
    <Type xmlns='AirSyncBase'>1</Type>
    <EstimatedDataSize xmlns='AirSyncBase'>0</EstimatedDataSize>
    <Data xmlns='AirSyncBase'/>
    </Body>
    </ApplicationData>
    </Change>
    </Commands>
    </Collection>
    </Collections>
    </Sync>
  3. All is well, you can make changes to the contact entry and push address book updates back and forth. Until you decide to send an email. Once you hit "send" in a message addressed to an email address from the contact entry, TbSync shows that little (i) icon next to the account that indicates local changes. And now, this is the updated contact entry that contains arbitrary "[object Object]" values in Title and Suffix fields:

    [XML: Sending data <send.request.localchanges> for marek@dokonalestavby.cz (Osobní kontakty)] : 
    <?xml version="1.0"?>
    <Sync xmlns='AirSync'>
    <Collections>
    <Collection>
    <SyncKey>1637061856</SyncKey>
    <CollectionId>vcard%252Fpersonal</CollectionId>
    <Commands>
    <Change>
    <ServerId>48-61939300-1-27DA3700.vcf</ServerId>
    <ApplicationData>
    <FileAs xmlns='Contacts'>Example%20User</FileAs>
    <FirstName xmlns='Contacts'>Example</FirstName>
    <LastName xmlns='Contacts'>User</LastName>
    <Email1Address xmlns='Contacts'>user%40example.org</Email1Address>
    <MobilePhoneNumber xmlns='Contacts'>123%20456%20789</MobilePhoneNumber>
    <Picture xmlns='Contacts'/>
    <Suffix xmlns='Contacts'>%5Bobject%20Object%5D</Suffix>
    <Title xmlns='Contacts'>%5Bobject%20Object%5D</Title>
    <Body xmlns='AirSyncBase'>
    <Type xmlns='AirSyncBase'>1</Type>
    <EstimatedDataSize xmlns='AirSyncBase'>0</EstimatedDataSize>
    <Data xmlns='AirSyncBase'/>
    </Body>
    </ApplicationData>
    </Change>
    </Commands>
    </Collection>
    </Collections>
    </Sync>

I can provide full debug log if needed.

TL;DR: The issue happens only after another client (Apple iPhone in this case) creates empty <Prefix> and <Suffix> fields in the contact entry in the first place.

marek-cerny commented 2 years ago

Any update on this?

The issue pretty much prevents us from using TbSync in our company environment.

Do you need any more info to narrow down the issue?

jobisoft commented 2 years ago

Is this still happening with EAS for Thunderbird 102? I had to rewrite the sync part and there is a high probability this has been fixed.

TbSync v4.1: https://github.com/jobisoft/TbSync/releases/download/v4.1/TbSync.xpi EAS v4.1.2: https://github.com/jobisoft/EAS-4-TbSync/files/9638174/EAS-4-TbSync.zip

Note: The pre-release of EAS v4.1 at https://github.com/jobisoft/EAS-4-TbSync/releases/download/v4.1/EAS-4-TbSync.xpi has a flaw which was fixed in v4.1.2 tonight but did not yet make it to the release section. Full story is here: https://github.com/jobisoft/EAS-4-TbSync/issues/167#issuecomment-1256217675

marek-cerny commented 2 years ago

Hello.

I've just tested with TbSync 4.1 and EAS 4.1.4 and it seems that the issue got fixed.

Sending an email to a contact still triggers an EAS update to that contact entry, but this time it doesn't look like an arbitrary values or bad data is being added/changed.

jobisoft commented 2 years ago

\o/

marek-cerny commented 2 years ago

I'll do some more testing, but it looks promising - thanks a lot for the hard work!