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

Cannot download attachment for some multipart/mixed messages with base64-encoded jpg images #9443

Closed
sebastka opened this issue May 8, 2024 · 5 comments · Fixed by #9472
Closed

Comments

@sebastka
Copy link

sebastka commented May 8, 2024

Hello,

We have an issue where pictures sent from a phone (presumably iPhone) to an e-mail address by Telenor DK will not be downloadable from Roundcube. The webmail will show the paperclip icon, indicating there is an attachment, but it won't be displayed when opening the message, nor will it allow the user to download it. See Example 1.
The same message opened in Thunderbird will show correctly and the attachment will be downloadable.

We have produced a similar example (Example 2) of a picture sent from an iPhone to an e-mail address using Telenor Norway, where Roundcube does show the attachment correctly.

Is this a bug in Roundcube?

  1. Example 1: Not OK - Cannot download attachment
Message-Id: <[email protected]>
Date:Mon, 06 May 2024 15:24:47 +0200
From: <[email protected]>
To: [email protected]
Subject: Not OK
Mime-Version:1.0
Content-Type:multipart/mixed;boundary="--------------------------------------------=_NextPart_0_24856"

this is a multi-part message in MIME format.

----------------------------------------------=_NextPart_0_24856
Content-Type:image/jpeg; name="Resized_20240427_200026(1).jpeg"
Content-Transfer-Encoding:base64
Content-Location:Resized_20240427_200026(1).jpeg
Content-ID:<Resized_20240427_200026(1)>

iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAADMElEQVR4nOzVwQnAIBQFQYXff81R
UkQCOyDj1YOPnbXWPmeTRef+/3O/OyBjzh3CD95BfqICMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMO0TAAD//2An
hf4QtqobAAAAAElFTkSuQmCC

----------------------------------------------=_NextPart_0_24856--
  1. Example 2: OK - Can download attachment
Content-Type: multipart/mixed; boundary=1_663B4185_194FAEF8
Date: Wed, 08 May 2024 09:10:29 GMT
To: [email protected]
Subject: OK
From: [email protected]
Mime-Version: 1.0

--1_663B4185_194FAEF8
Content-Type: image/jpeg;Name=IMG_0639.jpg
Content-Disposition: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CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0C
MK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMK0CMO0TAAD//2An
hf4QtqobAAAAAElFTkSuQmCC
--1_663B4185_194FAEF8--
@pabzm
Copy link
Member

pabzm commented May 14, 2024

The relevant difference is that the broken version's attachment mime-structure doesn't have a Content-Disposition-header. After adding that the message gets shown as expected.

We'll have to check if/how to fix this.

@pabzm
Copy link
Member

pabzm commented May 14, 2024

Related: #7117, #5905

@alecpl
Copy link
Member

alecpl commented May 16, 2024

Related to #5051. At least in this specific case we can more easily detect that the message has no html part so any images should be treated as non-inline.

@pabzm
Copy link
Member

pabzm commented May 17, 2024

Currently the image in the "Not OK" email is considered an inline image by Roundcube. I fiddled with some code in program/actions/mail/show.php to make it display the image, but maybe a more general approach to handle "dangling" images would be better.

Also I figured that some code probably relates to concrete edge cases, like is_attachment() – because for a general check this is too specific. Changing that code without tests checking these edge cases is too dangerous for my taste.

@alecpl Do you have some kind of test corpus of emails to check against? I started to extend TestCases in order to check the correct rendering of emails (will open a PR later).

@alecpl
Copy link
Member

alecpl commented May 17, 2024

I agree that fixing this kind of issues properly might involve quite a big refactoring. There's no easy bugs in this tracker ;).

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

Successfully merging a pull request may close this issue.

3 participants