From 16fd9ac04ca0d084662aa369e64168833ff7cec2 Mon Sep 17 00:00:00 2001 From: Kory Maincent Date: Wed, 28 Oct 2026 00:00:00 +0100 Subject: [PATCH] snagflash: fix crash when flashing a bz2 image with a bmap file The BZ2File class does not expose a "name" attribute before Python 3.13, unlike GzipFile which always had one. This leads to the following crash when flashing a bzip2-compressed image with a bmap file on Python < 3.13: File "snagflash/bmaptools/BmapCopy.py", line 192, in __init__ self._image_path = image.name AttributeError: 'BZ2File' object has no attribute 'name' Fix it by falling back to a generic description when the file object has no "name" attribute. _image_path is only used in log and error messages, so this does not change any behavior for regular files. Signed-off-by: Kory Maincent Assisted-by: opencode (GLM Flash) --- src/snagflash/bmaptools/BmapCopy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/snagflash/bmaptools/BmapCopy.py b/src/snagflash/bmaptools/BmapCopy.py index 8c48e88..b8ad4fe 100644 --- a/src/snagflash/bmaptools/BmapCopy.py +++ b/src/snagflash/bmaptools/BmapCopy.py @@ -189,7 +189,7 @@ def __init__(self, image, bmap=None, image_size=None): self._f_bmap_path = None self._f_image = image - self._image_path = image.name + self._image_path = getattr(image, "name", "compressed image") # The bmap file checksum type and length self._cs_type = None