I am typing the command as described in the GAM Wiki at https://github.com/jay0lee/got-your-back/wiki
Using ./gyb --email [email]@gmail.com --action restore --local-folder GYB-GMail-Backup-[email]@[domain].com --cleanup
Full steps to reproduce the issue:
Try to cleanup and restore an email that has utf-8 characters in the From header
Expected outcome (what are you trying to do?):
Email is cleaned up and restored
Actual outcome (what errors or bad behavior do you see instead?):
Traceback (most recent call last):
File "gyb.py", line 2532, in <module>
File "gyb.py", line 2007, in main
File "gyb.py", line 1769, in message_hygiene
File "gyb.py", line 1713, in cleanup_from
File "email\utils.py", line 215, in parseaddr
File "email\_parseaddr.py", line 513, in __init__
File "email\_parseaddr.py", line 256, in getaddrlist
TypeError: object of type 'Header' has no len()
[8912] Failed to execute script 'gyb' due to unhandled exception!
I'm not even sure if From headers are supposed to have utf-8 characters in them, as this only came up in 3 emails I was restoring that happened to be spam.
My workaround was to run the restore operation without the cleanup option for a block of 15 emails (that contained the offending character), then Ctrl-C, and run the restore operation with the cleanup operation on the rest of my emails.
Please confirm the following:
./gyb --email [email]@gmail.com --action restore --local-folder GYB-GMail-Backup-[email]@[domain].com --cleanup
Full steps to reproduce the issue: Try to cleanup and restore an email that has utf-8 characters in the From header
Expected outcome (what are you trying to do?): Email is cleaned up and restored
Actual outcome (what errors or bad behavior do you see instead?):
Normally, the line https://github.com/GAM-team/got-your-back/blob/e6f3c7b056a971dec9081d5254aceed941d414af/gyb.py#L1728 will return a string containing the contents of the
From
headerBut if the
From
header has a utf-8 character (U+00AE in my case), the above line will return an email.header.Header objectThen in line https://github.com/GAM-team/got-your-back/blob/e6f3c7b056a971dec9081d5254aceed941d414af/gyb.py#L1706
parseaddr
dies because it's passed an email.header.Header object, not a string.I'm not even sure if
From
headers are supposed to have utf-8 characters in them, as this only came up in 3 emails I was restoring that happened to be spam. My workaround was to run the restore operation without thecleanup
option for a block of 15 emails (that contained the offending character), then Ctrl-C, and run the restore operation with thecleanup
operation on the rest of my emails.