1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-02 09:10:11 +02:00

simplifying fix for "cannot identify image file" with XML icons

This commit is contained in:
Izzy 2018-01-17 16:48:08 +01:00
parent 6f5b539a54
commit 42ac65e8aa

View File

@ -1470,15 +1470,9 @@ def extract_apk_icons(icon_filename, apk, apkzip, repo_dir):
del apk['icons_src'][density]
empty_densities.append(density)
if '-1' in apk['icons_src']:
if '-1' in apk['icons_src'] and not apk['icons_src']['-1'].endswith('.xml'):
icon_src = apk['icons_src']['-1']
icon_path = os.path.join(get_icon_dir(repo_dir, '0'), icon_filename)
if icon_src.endswith('.xml'):
for f in apkzip.namelist():
if f.endswith(png):
m = re.match(r'res/(drawable|mipmap)-(x*[hlm]dpi).*/', f)
if m:
icon_src = f
with open(icon_path, 'wb') as f:
f.write(get_icon_bytes(apkzip, icon_src))
im = None