Skip to content

Auto-delete date mismatch #345

@mkirkland4874

Description

@mkirkland4874

Overview

In certain circumstances, there is a mismatch between the date path generated in base.py and the path generated in autodelete.py for the same image. When certain images are deleted on iCloud (i.e., moved to Recently Deleted album), autodelete.py looks at the wrong path when checking if the recently deleted file exists on the local filesystem and as such, the file is not properly deleted from the local filesystem.

Steps to Reproduce

  1. Have a photo with the following creation date uploaded to iCloud: June 23, 2021 5:34:45PM PST
  2. Use icloudpd to download the image to the local filesystem
  3. Delete the file from iCloud
  4. Run icloudpd with the --auto-delete option enabled
  5. Auto-delete will not properly delete the file that was deleted on iCloud

Expected Behavior

The created_date in base.py should match the created_date in autodelete.py for the same image.

Actual Behavior

Line 380 of base.py results in a created_date of 2021-06-23 17:34:45.892000-07:00 and a download path of Photos/2021/06/23/
380: created_date = photo.created.astimezone(get_localzone())

Line 21 of autodelete.py results in a created_date of 2021-06-24 00:34:45.892000+00:00 and a local path of Photos/2021/06/24/
21: created_date = media.created

Accordingly, the file on the local filesystem is actually located at Photos/2021/06/23/ but autodelete.py checks for it in folder Photos/2021/06/24/ and does not find it, so the file is not deleted from the local filesystem even though it was deleted on iCloud.

Context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions