ProtonMail / proton-bridge

Proton Mail Bridge application
GNU General Public License v3.0
1.14k stars 152 forks source link

Detaching attachments does not decrease message size #394

Open zwets opened 1 year ago

zwets commented 1 year ago

Expected Behavior

With "non-protonbridged" IMAP accounts, when I perform "detach attachment" in Thunderbird (which stores the attachment locally and removes it from the message, replacing it with a link to the local filename), the message size decreases by the size of the attachment. This is what I would expect from mail accessed over protonmail bridge as well.

Current Behavior

The message correctly saves in local storage and in the email is replaced by a link to the local copy, but the message size (as displayed by Thunderbird) remains the same, suggesting the attachment is not removed.

Possible Solution

It seems that "detach attachment" in Thunderbird copies the attachment to local disc, then cuts out the attachment, then stores the message back over IMAP. It appears that the bridge doesn't perform the last action (in the local cache?).

Steps to Reproduce

Email any (large) attachment and attempt the above procedure in Thunderbird, while enabling the "message size" column in Thunderbird's message list in order to see the message size not change.

Version Information

3.2.0

Context (Environment)

I prefer to not keep (large) attachments in my email account - or indeed have multiple copies of a single file. If I want to do this now, I must to move the message to another account (inside Thunderbird), then detach the attachment in the other account, then move the "stripped" message back to my (bridged) Proton account.

LBeernaertProton commented 1 year ago

Hey @zwets, thanks for the report.

We have internally tracked this issue as GODT-2671.

Unfortunately, this may have Proton API limitation written all over it. We will investigate and see if we can address this.

zwets commented 1 year ago

Thanks @LBeernaertProton . Observing Thunderbird, it seems that what it does is store a copy of the message (with the attachment detached) in the mailbox, then delete the original. (I'm on unreliable internet and occasionally see both messages left in mail folders.)

Theoretically then, it looks like Thunderbird is doing all the work, whereas on the IMAP server level only "store this new message" and "delete that old message" would be happening. But clearly if that were the case, then this scenario would already work, so I assume there's things going on with unique message identifiers?

LBeernaertProton commented 1 year ago

@zwets It is indeed partially related to message identifiers. There are also other aspects that are limitations of the Proton API.

That being said, things like these need to be evaluated on a broader scope with a collection of other clients, some of which exhibit less than desired behaviors (e.g: Outlook).