mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-11 15:13:27 +02:00
Merge branch 'fix-icon-crash' into 'master'
Fix crash when icon_name is None See merge request fdroid/fdroidserver!485
This commit is contained in:
commit
c54e32a3b8
@ -1086,7 +1086,7 @@ def _get_apk_icons_src(apkfile, icon_name):
|
||||
|
||||
"""
|
||||
icons_src = dict()
|
||||
density_re = re.compile('^res/(.*)/' + icon_name + '\.(png|xml)$')
|
||||
density_re = re.compile('^res/(.*)/{}\.(png|xml)$'.format(icon_name))
|
||||
with zipfile.ZipFile(apkfile) as zf:
|
||||
for filename in zf.namelist():
|
||||
m = density_re.match(filename)
|
||||
|
@ -647,6 +647,16 @@ class UpdateTest(unittest.TestCase):
|
||||
with self.assertRaises(fdroidserver.exception.FDroidException):
|
||||
fdroidserver.update.has_known_vulnerability('janus.apk')
|
||||
|
||||
def test_get_apk_icon_when_src_is_none(self):
|
||||
config = dict()
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
fdroidserver.common.config = config
|
||||
fdroidserver.update.config = config
|
||||
|
||||
# pylint: disable=protected-access
|
||||
icons_src = fdroidserver.update._get_apk_icons_src('urzip-release.apk', None)
|
||||
assert icons_src == {}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = optparse.OptionParser()
|
||||
|
Loading…
Reference in New Issue
Block a user