Skip to content

fix: handling attachment when it is the only part of the message#13202

Open
madbob wants to merge 1 commit into
nextcloud:mainfrom
madbob:issue_4423
Open

fix: handling attachment when it is the only part of the message#13202
madbob wants to merge 1 commit into
nextcloud:mainfrom
madbob:issue_4423

Conversation

@madbob

@madbob madbob commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

This is a pretty optimistic solution to an issue reported multiple times.

The assumption is that if the base structure of the message is not a multipart, nor an intelligible body, then the message is just composed by an attached file to be displayed.

Fixes #4423
Fixes #10752
Fixes #11673

@kesselb

kesselb commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for your PR

@ChristophWurst ChristophWurst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes sense

The only remark is that hasAttachments is probably wrong so such email wouldn't have the paperclip icon. That needs a fix in ImapMessageFetcher::hasAttachments.

@ChristophWurst

Copy link
Copy Markdown
Member

/backport to stable5.10

@github-actions

Copy link
Copy Markdown

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Signed-off-by: Roberto Guido <info@madbob.org>
@madbob

madbob commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

I don't think over-complicating hasAttachments() for an edge-case may be the best, given that it is also a recursive function and track there the specific case of the root message's part composed only by one file may become an headache.

Here I've just enforced the value of $this->hasAnyAttachment when there are no other chances.

Fun fact: I've accidentally moved hasAttachments() after the decryption of encrypted messages, only to realize that calling it before (in the original place) may produce broken results as the encrypted message has not yet been splitted in his MIME parts.

(Tests randomy failed on the latest push due external motivations)

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.

unable to access files (appends) from emails with no body Attachment not visible Attachments not shown

3 participants