gonejack/embed-email

file in use errors, renames failed, missing local files - see error messages

Opened this issue · 10 comments

C:\Users\jimsp\embed-test>embed-email
2022/01/07 18:02:54 process 2022.01.03.18.29-mcle2-JSW-MCLE Annual Verification Report 21829900 CRM_0018208-9559.eml
2022/01/07 18:02:54 download https://mymcle.texasbar.com/EmailResponse/images/logo-mcle.png as media\86cd0de1c9dbf234dbe59674d52c603e.png failed: rename media\86cd0de1c9dbf234dbe59674d52c603e.png.partial media\86cd0de1c9dbf234dbe59674d52c603e.png: The process cannot access the file because it is being used by another process.
2022/01/07 18:02:54 download https://mymcle.texasbar.com/EmailResponse/images/logo-sbot.png as media\c0e864e67d72d8b8b5ef1cc058f7a34a.png failed: rename media\c0e864e67d72d8b8b5ef1cc058f7a34a.png.partial media\c0e864e67d72d8b8b5ef1cc058f7a34a.png: The process cannot access the file because it is being used by another process.
2022/01/07 18:02:54 download https://mymcle.texasbar.com/EmailResponse/mcleread/icon/8970698e-7315-ec11-80e1-005056957304/AVR as media\6dd9e630526d3ae947ac6357a5014b47 failed: rename media\6dd9e630526d3ae947ac6357a5014b47.partial media\6dd9e630526d3ae947ac6357a5014b47: The process cannot access the file because it is being used by another process.
2022/01/07 18:02:54 ffmpeg not found, will not convert gif into mp4
2022/01/07 18:02:54 missing local file of https://mymcle.texasbar.com/EmailResponse/mcleread/icon/8970698e-7315-ec11-80e1-005056957304/AVR
2022/01/07 18:02:54 missing local file of https://mymcle.texasbar.com/EmailResponse/images/logo-sbot.png
2022/01/07 18:02:54 missing local file of https://mymcle.texasbar.com/EmailResponse/images/logo-mcle.png

Hi, @jimspoon

These tools mainly developed under MacOS, never tested and do fixes on Windows actually.

I will do the tests as soon as possible.

Hi gonejack, I'm happy to help any way I can. Just wanted to let you know that the email-to-html tool works fine on my Windows system. So the problem may just be in this email-embed tool and not the other tools. Thank you for your great tools.

Also after using email-to-html, I used html-to-email on the generated html files. Html-to-email files created EML files that have all the original images embedded. The new EML files have a subject line but not To: and From: headers, it seems that the HTML files did not have To: and From: info to put into the new EML files.

embed-email just ran in Ubuntu on the same computer, and successfully created EMLs with the remote images embedded in them.

Today I installed and ran Ubuntu, Go, and embed-email in the Windows Subsystem for Linux. Embed-email created EMLs with remote images embedded with no problems.

Hi, glad to hear Windows Subsystem is great fix for this issue. I am still seeking for a Windows machine..

Hi golang, just wanted to let you know I have encountered the same problem when running one or more of your other tools under Windows - I think it might have been saveurls. I wondered why a rename in the same Go program would work under MacOS or Linux but not in Windows, and found this, I wonder if it might be helpful to you- https://www.reddit.com/r/golang/comments/g5ftg0/osrename_on_windows/
Someone pointed out "On UNIX/Linux it's ok to rename, delete or move a file even though someone is using it, but not on Windows." The poster solved his problem by adding a file.Close() entry after the create function. So maybe if the .partial files are closed they can then be renamed?

Yes, it's caused by Windows's file system. Beside that we still need some tests like forbidden characters in Windows filenaming or file permissions.

Hi, @jimspoon

Version v1.0.15 should be compatible with Windows. Would you like to do a update to test if these issues are fixed

go install github.com/gonejack/embed-email@v1.0.15

embed-email 1.0.15 is working great in Windows! Thanks very much!