diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 9c6c21f3..83f069fa 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -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) diff --git a/tests/update.TestCase b/tests/update.TestCase index 03391c18..9c60adfd 100755 --- a/tests/update.TestCase +++ b/tests/update.TestCase @@ -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()