Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: detect imip messages from outlook.com #10661

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

kesselb
Copy link
Contributor

@kesselb kesselb commented Feb 6, 2025

Fix #10660

Adjust the parsing logic in MessageMapper to correctly detect iMIP messages in flat email structures where the text/calendar part is not wrapped in multipart/alternative.

The implementation loops over the message parts and then tries to fetch another part. This works for Gmail because the iMIP message is wrapped in multipart/alternative, but fails for Outlook.com, where the text/calendar part is not nested.

partIterator returns all parts, including nested ones.

Gmail:

body  
└─ multipart/alternative  
   ├─ text/plain  
   ├─ text/html  
   └─ text/calendar  
└─ application/ics  

Outlook.com:

body  
├─ text/plain  
├─ text/html  
└─ text/calendar  

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming writing a unit test for this is not trivial, is it?

@kesselb
Copy link
Contributor Author

kesselb commented Feb 6, 2025

I'm assuming writing a unit test for this is not trivial, is it?

We should have tests for it 🙏

Richard did some tests for smime, I will have a look if we can start from there.

Adjust the parsing logic in MessageMapper to correctly detect iMIP messages in flat email structures where the text/calendar part is not wrapped in multipart/alternative.

Signed-off-by: Daniel Kesselberg <[email protected]>
@kesselb kesselb force-pushed the bug/10660/imip-outlook branch from 43f49e0 to b965355 Compare February 6, 2025 20:24
@kesselb kesselb requested a review from GretaD as a code owner February 6, 2025 20:24
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😻

@ChristophWurst ChristophWurst merged commit 4409e7f into main Feb 7, 2025
35 checks passed
@ChristophWurst ChristophWurst deleted the bug/10660/imip-outlook branch February 7, 2025 05:44
@kesselb
Copy link
Contributor Author

kesselb commented Feb 7, 2025

/backport to stable4.2

@kesselb
Copy link
Contributor Author

kesselb commented Feb 7, 2025

/backport to stable3.7

Copy link

backportbot bot commented Feb 7, 2025

The backport to stable3.7 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable3.7
git pull origin stable3.7

# Create the new backport branch
git checkout -b backport/10661/stable3.7

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick b9653556

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/10661/stable3.7

Error: No changes found in backport branch


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@ChristophWurst
Copy link
Member

/backport to stable4.1

@SebastianKrupinski
Copy link
Contributor

RFC examples of possible iMip Messages

https://datatracker.ietf.org/doc/html/rfc2447#section-4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Email from Outlook not detected as iMIP message
3 participants