axllent / imap-scrub

A ultility to trim down your IMAP mailbox by saving & removing attachments or deleting messages based on rules
MIT License
20 stars 5 forks source link

Avoid altering messages that don't have attachments #7

Closed allentiak closed 5 months ago

allentiak commented 1 year ago

Hi, Ralf, Great tool!

While using the app, I noticed that it also modifies messages that are not to be changed at all (e.g. messages without attachments).

axllent commented 1 year ago

Hi @allentiak. I'm glad you find the tool useful :)

When you say it makes changed to "unmodified messages" (eg: without attachments etc), can you be a bit more specific? What exactly is modified in these messages you are referring to?

allentiak commented 1 year ago

Sure, @axllent,

I did a "actions: save_attachments, remove_attachment" of all of my messages.

For a few messages that didn't have any attachment, I received the notification "deleting original message" (of something like that).

I asked myself: why would the program delete the original message of it had no attachments? My guess was (and I could be wrong here - I haven't read the source code in detail) that the messages are modified before actually processing their attachment(s).

Assuming my hunch is right, I consider that to be an incorrect workflow. IMHO, the messages should be first analyzed, and only altered if (any of) their attachment(s) is (are) to be removed.

Again: I could be wrong about all this, so please take my words with a grain of salt.

axllent commented 1 year ago

You are probably right - I do need to revise all this code at some stage anyway (mostly to refresh my memory) as this project hasn't had much love in quite a while. It'll be a couple of weeks (most likely) before I can look into this, so I'm not ignoring you, I just don't have much free time at the moment.

allentiak commented 1 year ago

Sure, no problem!

In fact, I first tried going through the code so I could send you a PR. But (and again, this was just a quick overview) it wasn't obvious for me where exactly I should make the change...

axllent commented 5 months ago

This has finally been fixed thanks to @michalfapso's efforts