diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 15b055e0..e1e095fc 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -1081,6 +1081,11 @@ def scan_apk(apk_file): def _get_apk_icons_src(apkfile, icon_name): """Extract the paths to the app icon in all available densities + The folder name is normally generated by the Android Tools, but + there is nothing that prevents people from using whatever DPI + names they make up. Android will just ignore them, so we should + too. + """ icons_src = dict() density_re = re.compile(r'^res/(.*)/{}\.(png|xml)$'.format(icon_name)) @@ -1089,9 +1094,9 @@ def _get_apk_icons_src(apkfile, icon_name): m = density_re.match(filename) if m: folder = m.group(1).split('-') - if len(folder) > 1 and folder[1].endswith('dpi'): + try: density = screen_resolutions[folder[1]] - else: + except Exception: density = '160' icons_src[density] = m.group(0) if icons_src.get('-1') is None and '160' in icons_src: