Skip to content

Fix issue #926 keyerror adjusted alternative#1235

Merged
AndreyNikiforov merged 2 commits intoicloud-photos-downloader:masterfrom
AndreyNikiforov:fix/issue-926-keyerror-adjusted-alternative
Aug 30, 2025
Merged

Fix issue #926 keyerror adjusted alternative#1235
AndreyNikiforov merged 2 commits intoicloud-photos-downloader:masterfrom
AndreyNikiforov:fix/issue-926-keyerror-adjusted-alternative

Conversation

@AndreyNikiforov
Copy link
Copy Markdown
Collaborator

No description provided.

AndreyNikiforov and others added 2 commits August 30, 2025 08:32
Move filename calculation logic from PhotoAsset.versions property into separate
reusable function and remove filename property from AssetVersion class.

Key changes:
- Add calculate_asset_version_filename() function in asset_version.py
- Remove filename parameter from AssetVersion constructor
- Add filename_override property for disambiguation purposes
- Add calculate_version_filename() method to PhotoAsset class
- Update disambiguate_filenames() to accept PhotoAsset parameter
- Fix circular import by moving add_suffix_to_filename helper
- Update all filename property access points throughout codebase
- Add py.typed markers for strict mypy compliance
- Update tests to use new AssetVersion constructor signature

This refactoring separates concerns, improves code reusability, and maintains
full backward compatibility while passing all tests and strict mypy checks.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add test cases that validate fix for KeyError when downloading photos with
  --size adjusted --size alternative options (issue icloud-photos-downloader#926)
- Update test expectations to match corrected behavior after refactoring
- Fix AssetVersion constructor calls in remaining test cases
- Update CHANGELOG.md to document the bug fix

Tests now properly validate that missing adjusted/alternative versions
fall back to original version without throwing KeyError exceptions.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@AndreyNikiforov AndreyNikiforov merged commit 5bd53a0 into icloud-photos-downloader:master Aug 30, 2025
398 checks passed
@AndreyNikiforov AndreyNikiforov deleted the fix/issue-926-keyerror-adjusted-alternative branch August 30, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant