Skip to content

Conversation

@finkyseb
Copy link

@finkyseb finkyseb commented Nov 3, 2025

Example of content-type not properly manage

Content-Type: multipart/related; boundary=004_PARP264MB67443FFE96E5ACB5C06D04C3BEF2APARP264MB6744FRAP; type="multipart/alternative"

Base information

Question Answer
Related to a SourceForge thead / Another PR / Combodo ticket?
Type of change? Bug fix

Symptom (bug) / Objective (enhancement)

Reproduction procedure (bug)

  1. On 2.7.11-14870
  2. With module combodo-email-synchro: version 3.7.2
  3. With PHP 7.2.24
  4. Receive a email from exchange platform (Hotmail, onPremise Exchange, ...)
  5. This mail contents an inline image
  6. The ticket create from this email appears empty (description)
  7. Finally, the ticket created is useless.

Cause (bug)

Example of content-type not properly managed in exchange mail with inline pictures.

Content-Type: multipart/related; boundary=_004_PARP264MB67443FFE96E5ACB5C06D04C3BEF2APARP264MB6744FRAP_; type="multipart/alternative"

original regex :
if (($sContentType != '') && preg_match('/multipart(.*);.*?boundary="?([^"]+)"?/i', $sContentType, $aMatches))
It gets this value _004_PARP264MB67443FFE96E5ACB5C06D04C3BEF2APARP264MB6744FRAP_; type=

Proposed solution (bug and enhancement)

If you fix the regex with this :
if (($sContentType != '') && preg_match('/multipart(.*);.*?boundary="?([^";]+)"?/i', $sContentType, $aMatches))
It gets the attended value : _004_PARP264MB67443FFE96E5ACB5C06D04C3BEF2APARP264MB6744FRAP_

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested all changes I made on an iTop instance
  • Would a unit test be relevant and have I added it?
  • Is the PR clear and detailed enough so anyone can understand without digging in the code?

Example of content-type not properly manage

Content-Type: multipart/related; boundary=_004_PARP264MB67443FFE96E5ACB5C06D04C3BEF2APARP264MB6744FRAP_; type="multipart/alternative"
@github-project-automation github-project-automation bot moved this to Hacktoberfest in Combodo PRs dashboard Nov 3, 2025
@jf-cbd jf-cbd moved this from Hacktoberfest to First review needed in Combodo PRs dashboard Nov 3, 2025
@jf-cbd jf-cbd changed the title 🩹 Updates regex to match the mail content id properly N°8889 - 🩹 Updates regex to match the mail content id properly Nov 6, 2025
@jf-cbd
Copy link
Member

jf-cbd commented Nov 12, 2025

Hello, thank you for your PR :D
Could you please provide a unit test (with an EML email file that allows to reproduce the issue) to cover this change (only this case, to avoid future regressions) ? If you don't feel confident with it, just provide an EML file and I'll write the test.
Also, please note that this fix will be released in a next version of the extension, that won't be compatible with your iTop's version.

@jf-cbd jf-cbd moved this from First review needed to Pending contributor update in Combodo PRs dashboard Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending contributor update

Development

Successfully merging this pull request may close these issues.

3 participants