mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 15:32:30 +03:00
update: handle random drawable folder names when parsing icons
The app com.android.acehk.aceapp37423 had this invalid stuff in it: 6165 2014-03-28 12:52 res/drawable-320dpi/ic_launcher.png
This commit is contained in:
parent
a9cc7f6358
commit
c8e61aa02d
1 changed files with 7 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue