Skip to content

Attachment is seen as inline because the filename is included in the body of the message #482

@genbtasma

Description

@genbtasma

Describe the bug

An attachment is seen as inline if the filename is included in the body of the message, even when it's just added as normal text.

This seems to be caused by this check in the Message.cs file:

                if (body.Contains($"{attach.FileName}")) continue;
                Logger.WriteToLog("Marking the attachment as NOT inline because we can't find it in the HTML body");

When I remove this line of code it is detected correctly, both with and without inline images.

To Reproduce

Steps to reproduce the behavior:

  1. Create an MSG file with an attachment (for example the file 'test.jpg')
  2. Make sure the attachment contains a ContentId
  3. Add the name of the file somewhere in the body as normal text (so 'test.jpg')
  4. Execute new Reader().ExtractToFolder
  5. See that the test.jpg file is seen as inline

Expected behavior

Don't mark an attachment as inline if the filename appears in the body without a cid prefix.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions