Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete-after-download deletes photos from iCloud that haven't been successfully downloaded #614

Closed
jpavlav opened this issue Apr 1, 2023 · 1 comment
Labels

Comments

@jpavlav
Copy link

jpavlav commented Apr 1, 2023

Overview

When specifying the delete-after-download flag on CLI the media item is deleted from iCloud whether or not the download succeeds. This is, I'd wager, something that folks will be surprised by (I definitely was).

Steps to Reproduce

  1. Execute any download command that includes the delete-after-download flag:
icloudpd --directory . --username <user> --delete-after-download --recent 100 --folder-structure <photo_dir>
  1. I think the check to reproduce this, you probably need to short circuit the download_media function to skip to else condition.
  2. Observe the ouput, the file is not downloaded, but it is deleted from iCloud:
Error downloading RPReplay_Final1651790030.mp4, retrying after 5 seconds...
Error downloading RPReplay_Final1651790030.mp4, retrying after 10 seconds...
Error downloading RPReplay_Final1651790030.mp4, retrying after 15 seconds...
Error downloading RPReplay_Final1651790030.mp4, retrying after 20 seconds...
Error downloading RPReplay_Final1651790030.mp4, retrying after 25 seconds...
Could not download RPReplay_Final1651790030.mp4! Please try again later.
Downloading/RPReplay_Final1651790030.mp4:  68%|6| 68/102023-04-01 01:00:50 INFO     Deleting RPReplay_Final1651790030.mp4

Expected Behavior

It makes sense, that if a download fails, that the file in iCloud should not be deleted. It puts the user in a position where they now have to negotiate restoring a photo/video, instead of just trying to download it again in the normal fashion.

Actual Behavior

The file is not downloaded to disk and is deleted from iCloud. In my case, I'm going to have to now figure out which files I don't have locally and attempt to restore all of them (hundreds, potentially over a thousand files) so that I can download them again.

Context

I started a branch to work on this, but the issue is that the result of the download is nested so far away from the code that governs deleting after download, it would either require passing in the delete-after-download flag to the download function (which might work) and make the adjustment there.

Otherwise, this download function, that appears to just be the result of calling this download_builder factory function needs to actually return the result of the download so that it (probably as a bool) can be evaluated with the delete-after-download flag to make an informed decision about deletion.

@AndreyNikiforov
Copy link
Collaborator

fixed in v1.13.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants