From d2501f355ffe3b5c9b77009fe72889ad84c7c7bb Mon Sep 17 00:00:00 2001 From: Nico Hinderling Date: Tue, 28 Oct 2025 09:37:57 -0700 Subject: [PATCH] Ensure all asset catalog images are considered --- .../artifacts/apple/zipped_xcarchive.py | 20 +++++++++++-------- .../apple/alternate_icons_optimization.py | 7 +++---- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/launchpad/artifacts/apple/zipped_xcarchive.py b/src/launchpad/artifacts/apple/zipped_xcarchive.py index 2b757a59..59cf6615 100644 --- a/src/launchpad/artifacts/apple/zipped_xcarchive.py +++ b/src/launchpad/artifacts/apple/zipped_xcarchive.py @@ -374,14 +374,18 @@ def _parse_asset_element(self, item: dict[str, Any], parent_path: Path) -> Asset colorspace = item.get("colorspace") file_extension = Path(filename).suffix.lower() - if filename and file_extension in {".png", ".jpg", ".jpeg", ".heic", ".heif"}: - potential_path = parent_path / f"{image_id}{file_extension}" - if potential_path.exists(): - full_path = potential_path - else: - full_path = None - else: - full_path = None + full_path = None + + if filename: + if file_extension in {".png", ".jpg", ".jpeg", ".heic", ".heif"}: + potential_path = parent_path / f"{image_id}{file_extension}" + if potential_path.exists(): + full_path = potential_path + elif not file_extension: + # No extension, try .png as default (for some asset catalog entries) + potential_path = parent_path / f"{image_id}.png" + if potential_path.exists(): + full_path = potential_path return AssetCatalogElement( name=name, diff --git a/src/launchpad/size/insights/apple/alternate_icons_optimization.py b/src/launchpad/size/insights/apple/alternate_icons_optimization.py index ca5d3261..6cd1eaf2 100644 --- a/src/launchpad/size/insights/apple/alternate_icons_optimization.py +++ b/src/launchpad/size/insights/apple/alternate_icons_optimization.py @@ -71,7 +71,6 @@ def _resize_icon_for_analysis(self, img: Image.Image) -> Image.Image: ) def _is_alternate_icon_file(self, file_info: FileInfo, alternate_icon_names: set[str]) -> bool: - return ( - file_info.file_type.lower() in self.OPTIMIZABLE_FORMATS - and Path(file_info.path).stem in alternate_icon_names - ) + # Some asset catalog entries have no extension, so we include "other" in the OPTIMIZABLE_FORMATS + file_type_match = file_info.file_type.lower() in (self.OPTIMIZABLE_FORMATS | {"other"}) + return file_type_match and Path(file_info.path).stem in alternate_icon_names