mail-client-extensions icon indicating copy to clipboard operation
mail-client-extensions copied to clipboard

[FIX] Outlook: fix crash when adding inline images

Open juwu-odoo opened this issue 5 months ago • 0 comments

Currently logging emails can crash if there are more inline image attachments than img tags.

Steps to reproduce

  1. Reply to an email that has an inline image
  2. From the reply, select "Log Email Into Contact"
  3. No log is created and the button is stuck in the loading state

Cause

Currently, we loop through inlineAttachments to match them one-to-one with the document's img tags. But the counter does not consider the case where there's a different number of inlineAttachments and imageElements. This usually happens when there's an img in the email history which is removed at the top of the function, but the attachment still exists. Some emails can also have embeded inline attachments that are unused.

Fix

Use two counters so that we don't hit an index out of bounds error. Also filter by img elements using cid: in src, so we don't overwrite img elements using URL images.

opw-4855422

juwu-odoo avatar Jul 07 '25 18:07 juwu-odoo