Skip to content

Download fails when iCloud photo has a filename attribute with strange (empty?) value #935

@MicaelJacobsson

Description

@MicaelJacobsson

Overview

I have photos with a seemingly empty value as filename. I think it came from uploading photos to iCloud causing duplicates. When downloading my entire library each such photo cause an uncaught exception and terminates the download

Steps to Reproduce

Try to download an iCloud photo where the filename shown in the photo Details is empty

Expected Behavior

The filename of the downloaded file should be set to truncated fingerprint by the code below

# Some photos don't have a filename.
        # In that case, just use the truncated fingerprint (hash),
        # plus the correct extension.
        filename = re.sub('[^0-9a-zA-Z]', '_', self.id)[0:12]

Actual Behavior

There is an exception thrown from this piece of code just above:

            _filename = self._service.filename_cleaner(**base64.b64decode(
                fields['filenameEnc']['value']
            )**.decode('utf-8'))

Context

I added a try: except on line 613 in icloud_photos_downloader\src\pyicloud_ipd\services\photos.py around that entire first if-clause, and rebuilt. With that build I could download the entire library, and the file-names of the strange photos were set from the truncated hash.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions