Skip to content

Commit c328f91

Browse files
ignapkmirkobrombin
authored andcommitted
Fix some ICO files not converting to PNG
Some ICO files are incorrectly identified as TARGA by libmagic file utility, used to obtain the MIME type of the extracted icon from the executable while creating a desktop entry using dynamic launcher portal. They are then assumed to be already PNG, and therefore are not correctly converted, which results in failure to validate the icon by the portal. While this is a libmagic bug, workaround it by assuming that "image/x-tga" MIME type also indicates ICO files. See https://bugs.astron.com/view.php?id=723 Helps: #4402
1 parent eefb780 commit c328f91

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bottles/backend/utils/manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ def extract_icon(config: BottleConfig, program_name: str, program_path: str) ->
206206
os.remove(ico_dest)
207207

208208
ico.export_icon(ico_dest_temp)
209-
if get_mime(ico_dest_temp) == "image/vnd.microsoft.icon":
209+
# Some ICO files are incorrectly identified as TARGA
210+
# See https://bugs.astron.com/view.php?id=723
211+
if get_mime(ico_dest_temp) in ["image/vnd.microsoft.icon", "image/x-tga"]:
210212
if not ico_dest_temp.endswith(".ico"):
211213
shutil.move(ico_dest_temp, f"{ico_dest_temp}.ico")
212214
ico_dest_temp = f"{ico_dest_temp}.ico"

0 commit comments

Comments
 (0)