Skip to content

ID7 suffix missing from adjusted/alternative filenames in v1.32.1+ #1299

@spmp

Description

@spmp

Overview

ID7 suffix missing from adjusted/alternative filenames in v1.32.1+

A regression was introduced in v1.32.1 where the name-id7 file match policy is not being applied to adjusted and alternative size downloads. This causes filenames to be missing their 7-character ID suffix. Expected behavior (v1.32.0):

IMG_9815_QVRmWmV.HEIC # original - has ID7 ✓
IMG_9815_QVRmWmV-adjusted.HEIC # adjusted - has ID7 ✓
IMG_9815_QVRmWmV-medium.JPG # medium - has ID7 ✓
Actual behavior (v1.32.1+):

IMG_9815_QVRmWmV.HEIC # original - has ID7 ✓
IMG_9815-adjusted.HEIC # adjusted - MISSING ID7 ✗
IMG_9815_QVRmWmV-medium.JPG # medium - has ID7 ✓

Root cause: The refactoring in commit f52826c ("refactor: make AssetVersion immutable by moving filename disambiguation to caller") changed disambiguate_filenames() to call photo_asset.calculate_version_filename(), which uses self.filename - the raw filename WITHOUT file_match_policy applied. This causes filename comparisons and override generation to work with filenames missing the ID7 suffix. While commit f42639c introduced the filename_builder factory pattern to address this issue in base.py, the disambiguate_filenames() function was not updated to use it. Impact: Users with --file-match-policy name-id7 downloading adjusted or alternative sizes will get incorrectly named files, potentially causing:

  • File organization issues
  • Duplicate detection failures
  • Confusion when the same photo has inconsistent naming across sizes

Steps to Reproduce

  1. icloudpd --recent 11 --directory /tmp/icloudpd-photos-adjusted-filename-id7-regression --folder-structure none --set-exif-datetime --keep-unicode-in-filenames --file-match-policy name-id7 --log-level debug --size original --size adjusted --size medium
  2. Adjusted file names are wrong as compared to previous releases (and existing library)

Expected Behavior

Filenames as:

IMG_9815_QVRmWmV.HEIC              # original - has ID7 ✓
IMG_9815_QVRmWmV-adjusted.HEIC     # adjusted - has ID7 ✓
IMG_9815_QVRmWmV-medium.JPG        # medium - has ID7 ✓

Actual Behavior

Filenames as:

IMG_9815_QVRmWmV.HEIC              # original - has ID7 ✓
IMG_9815-adjusted.HEIC             # adjusted - MISSING ID7 ✗
IMG_9815_QVRmWmV-medium.JPG        # medium - has ID7 ✓

Context

Release. This is a bug introduced v1.32.1

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