From c7c81aada830832a72c1a110e16d5c6a0802fb4c Mon Sep 17 00:00:00 2001 From: Nymiro <134183112+Bai-Mirror@users.noreply.github.com> Date: Mon, 20 Oct 2025 20:51:54 +1300 Subject: [PATCH] Fix ItemInfoEntryBox builder order --- heic_types.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/heic_types.py b/heic_types.py index e511121..d75bdac 100644 --- a/heic_types.py +++ b/heic_types.py @@ -274,12 +274,10 @@ class ItemInfoEntryBox(FullBox): content.write(item_name_bytes_to_write) elif self.version == 2: - # --- START FIX 4 (Builder) --- - # 保持为苹果顺序 (ID, Type, ProtIdx) 以正确 *写入* 兼容文件 content.write(struct.pack('>I', self.item_id)) - content.write(self.item_type.encode('ascii').ljust(4, b'\x00')) content.write(struct.pack('>H', self.item_protection_index)) - # --- END FIX 4 --- + # item_type 必须是 4 字节的 4CC,若不足则以 NUL 填充 + content.write(self.item_type.encode('ascii', errors='ignore')[:4].ljust(4, b'\x00')) content.write(item_name_bytes_to_write) elif self.version == 3: