1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-07-04 16:30:12 +02:00

fix "cannot identify image file" with XML icons

This commit is contained in:
Izzy 2018-01-12 22:12:27 +01:00
parent 56a53055be
commit 6f5b539a54

View File

@ -1473,6 +1473,12 @@ def extract_apk_icons(icon_filename, apk, apkzip, repo_dir):
if '-1' in apk['icons_src']:
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