RealRaven2000 / quickFilters

Thunderbird Add-on: quickFilters
http://quickfilters.quickfolders.org/
Other
49 stars 11 forks source link

Save attachments to does not save attachments #25

Closed JosiahCarberry closed 3 years ago

JosiahCarberry commented 3 years ago

Environment: FiltaQuilla 2.0 Thunderbird 68.10.0 64 bit Ubuntu 20.04

Steps: 1) Make sure "Save attachments to" is checked under FilterQuilla preferences | Filter actions 2) Set application rules Manually Run and Getting New Mail (Filter before Junk classification) 3) Set any matching criteria, so long as they include messages with attachments 4) Set the following actions to perform: 4a) Save attachments to; select a folder in which the logged user can create and write files 4b) Mark as read 5) Receive messages with attachments

Expected Results: 1) the messages meeting the matching criteria are flagged as read 2) the attachments of the messages meeting the matching criteria are saved to the designated folder

Actual results: 1) the messages meeting the matching criteria are flagged as read 2) No attachments of the messages meeting the matching criteria are saved to the designated folder

RealRaven2000 commented 3 years ago

I am going to attack this after we (that is probably I) have converted the Add-on for Thunderbird 78. There is no point in expending energies on Thunderbird 68 now that we have put hundreds of hours into converting my commercial Add-ons for the next step ("mail extensions") - we have to move away from the legacy model in the long term. First step will be to convert FiltaQuilla to a "mail extension with experimental APIs" - essentially a wolf in sheep's clothing.

Please subscribe to https://github.com/RealRaven2000/FiltaQuilla/issues/64 for news on FQ

RealRaven2000 commented 3 years ago

I worked on the detach attachments function yesterday, can you check this version: filtaquilla-3.0pre47.zip

If you try to save (or detach) the attachment again afterwards this function will currently fail and create an empty file, with an error in error console like this:

SaveAttachmentCallback
Save attachment [0] to E:\Dev\Mozilla\Dev\FiltaQuilla\test\detach\revision.txt...
 msgURI=imap-message://seawonkey%40gmail.com@mail.gmail.com/INBOX#4688
 att.url=file:///E:/Dev/Mozilla/Dev/FiltaQuilla/test/detach/revision-1.txt?part=1.2
 att.ncontentType=text/plain

Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsIMessenger.saveAttachmentToFile]

the error message will contain the original path of where it was detached to, in this case: att.url=file:///E:/Dev/Mozilla/Dev/FiltaQuilla/test/detach/revision-1.txt

If there are multiple attachments, this does not recover after the first exception (so more attachments after failed one will be ignored). I am thinking about tidying up (deleting) the empty file as it has no real function.

RealRaven2000 commented 3 years ago

Here is another version that avoid making the empty file. The log entry is currently showing only in error console but should show the original location of the already detached attachment.

filtaquilla-3.0pre48.zip not quite sure how to improve this...

JosiahCarberry commented 3 years ago

Coincidentally, I looked at this issue again today. Is the problem the handling of a path that contains a space? I don't have Thunderbird 78 yet - waiting for the powers that be at Ubuntu to get up to speed.

RealRaven2000 commented 3 years ago

Coincidentally, I looked at this issue again today. Is the problem the handling of a path that contains a space? I don't have Thunderbird 78 yet - waiting for the powers that be at Ubuntu to get up to speed.

no it's just if you detach an attachment from a mail then it's physically not there anymore (there is however a URL that points to the file location where it was detached to - obviously that won't help if you delete or move the file elsewhere). That's why next time you save the attachment it leads to an empty file. it's basically a useless empty duplicate.

JosiahCarberry commented 3 years ago

That may be, but I changed a directory name that had a space in it to one without spaces, updated it in the relevant message filter, and lo, the mail I received today was correctly processed. And I am sure the the filter had been correctly setup up previously.

RealRaven2000 commented 3 years ago

I just realized that we are on the wrong github here. Why don't we take this over to FiltaQuilla? https://github.com/RealRaven2000/FiltaQuilla/issues/76 I tested and successfully saved attachements to E:\Dev\Mozilla\Dev\FiltaQuilla\test\detach\spaces test but that was in Windows

JosiahCarberry commented 3 years ago

Well, I don't know if something special is happening in Ubuntu when the path to which the attachment is saved has a space. In any case, it wasn't working for me, but maybe the problem was elsewhere.

On the other hand, if Filtaquilla is supposed to be detaching attachments, as you imply above, you might consider changing the label for the filter action from "Save attachments to" to "Detach attachments to".

RealRaven2000 commented 3 years ago

On the other hand, if Filtaquilla is supposed to be detaching attachments, as you imply above, you might consider changing the label for the filter action from "Save attachments to" to "Detach attachments to".

That's two different actions supported by FiltaQuilla, which are separate things, but use the same callback function in part:

image

RealRaven2000 commented 3 years ago

Plenty of attachment issues on the filtaquilla issue tracker, so going to close this here.