GAM-team / got-your-back

Got Your Back (GYB) is a command line tool for backing up your Gmail messages to your computer using Gmail's API over HTTPS.
https://github.com/GAM-team/got-your-back/wiki
Apache License 2.0
2.6k stars 205 forks source link

Adding to existing label fails #385

Open Suncatcher opened 2 years ago

Suncatcher commented 2 years ago

Please confirm the following:

Full steps to reproduce the issue:

  1. Counting messages on target mailbox with label SomeLabel before restore gyb --email target@gmail.com --action estimate --search "label:SomeLabel"
Got 939 Message IDs
GYB needs to examine 939 messages
GYB already has a backup of 0 messages
Estimated size 17.31mb 939/939 messages
  1. Restoring 69 messages with command gyb --email target@gmail.com --action restore --local-folder GYB-GMail-Backup-source@gmail.com --label-restored "SomeLabel" gives warning on every message
...
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
restoring 30 messages (30/69)
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
restoring 30 messages (60/69)
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
restoring 9 messages (69/69)
  1. Counting SomeLabel messages in target after restore
Got 989 Message IDs
GYB needs to examine 989 messages
GYB already has a backup of 0 messages
Estimated size 19.14mb 989/989 messages

Expected outcome (what are you trying to do?):

All messages imported successfullly to label SomeLabel

Actual outcome (what errors or bad behavior do you see instead?):

Only 50 messages were imported into the label out of 69

So the script doesn't allow importing messages to the label that already exists and doesn't imports correctly. Please, fix it.

Suncatcher commented 2 years ago

After re-inspecting the account again, I can add that those 19 messages that were skipped (50 out of 69 were processed only) were most likely duplicates that already existed on the target with this label. This is very related to the issue #378 I created earlier. GYB now does not understand and cannot handle duplicates on target. This can be added in future versions as an improvement.