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

Auto-delete deletes image in library if duplicate is deleted #346

Open
mkirkland4874 opened this issue Jun 30, 2021 · 3 comments
Open

Auto-delete deletes image in library if duplicate is deleted #346

mkirkland4874 opened this issue Jun 30, 2021 · 3 comments
Labels

Comments

@mkirkland4874
Copy link

Overview

The auto-delete feature will inadvertently delete an original photo that is in the iCloud library from the local file system if a duplicate of that image is in the Recently Deleted album.

Steps to Reproduce

  1. Add an image to the iCloud library
  2. Duplicate the image on iCloud (by using the Duplicate function on MacOS Photos or iOS device)
  3. Delete the duplicate image (i.e., move it to the Recently Deleted album)
  4. Run icloudpd with --auto-delete enabled
  5. icloudpd will delete the original image from the local filesystem even though the image still exists in the iCloud library

Expected Behavior

Auto-delete should not delete a file from the local filesystem that still exists in the iCloud library even though a duplicate of the file exists in the Recently Deleted album.

Actual Behavior

When an image exists in the iCloud library and a duplicate of the image exists in the Recently Deleted album, the auto-delete feature will delete the image in the iCloud library from the local filesystem even though it still exists in the library.

Context

Other issues in the repo have documented that iCloud allows duplicate images to exist in the iCloud library even though they have the same filename. This bug in the auto-delete function seems to be a consequence of that.

@smaugfm
Copy link

smaugfm commented Jun 7, 2024

@AndreyNikiforov
Stumbled upon this just now. I sometimes upload a photo, make edits to the original and then re-upload it again (with the same filename) and delete the first one.
As they have the same filename and as long as the first one is in the Recently Deleted album icloudpd keeps looping the following actions:

  • downloads edited photo
  • deletes edited photo because it sees the original in Recently Deleted has the same filename
  • next time it downloads the edited photo again because it's missing and so on

A solution might be to add an option like --file-name-pattern, similar to --folder-structure where one may reference placeholders i.e.asset hash, asset creation date, asset original filename and so on, to help disambiguate between different assets that have the same filename.

@AndreyNikiforov
Copy link
Collaborator

i am considering to add an option to use id suffix with image name and turn off deduplication. need to think through migration scenario though.

@AndreyNikiforov
Copy link
Collaborator

@smaugfm pls see if #867 solves the issue for you.

Note that PR does not address migration of the existing local library to the introduced file naming - it will have to be worked on separately.

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

3 participants