mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-19 21:30:10 +01:00
parent
ba854cbc0f
commit
d9171f11e0
@ -1448,8 +1448,9 @@ def scan_apk_androguard(apk, apkfile):
|
|||||||
logging.error(_("Failed to get apk information, skipping {path}")
|
logging.error(_("Failed to get apk information, skipping {path}")
|
||||||
.format(path=apkfile))
|
.format(path=apkfile))
|
||||||
raise BuildException(_("Invalid APK"))
|
raise BuildException(_("Invalid APK"))
|
||||||
except FileNotFoundError:
|
except (FileNotFoundError, zipfile.BadZipFile) as e:
|
||||||
logging.error(_("Could not open apk file for analysis"))
|
logging.error(_("Could not open APK {path} for analysis: ").format(path=apkfile)
|
||||||
|
+ str(e))
|
||||||
raise BuildException(_("Invalid APK"))
|
raise BuildException(_("Invalid APK"))
|
||||||
|
|
||||||
apk['packageName'] = apkobject.get_package()
|
apk['packageName'] = apkobject.get_package()
|
||||||
|
@ -625,6 +625,20 @@ class UpdateTest(unittest.TestCase):
|
|||||||
with self.assertRaises(fdroidserver.exception.BuildException):
|
with self.assertRaises(fdroidserver.exception.BuildException):
|
||||||
fdroidserver.update.scan_apk('urzip-release-unsigned.apk')
|
fdroidserver.update.scan_apk('urzip-release-unsigned.apk')
|
||||||
|
|
||||||
|
def test_scan_apk_bad_zip(self):
|
||||||
|
config = dict()
|
||||||
|
fdroidserver.common.fill_config_defaults(config)
|
||||||
|
fdroidserver.common.config = config
|
||||||
|
fdroidserver.update.config = config
|
||||||
|
testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir)
|
||||||
|
os.chdir(testdir)
|
||||||
|
os.mkdir('repo')
|
||||||
|
apkfile = 'repo/badzip_1.apk'
|
||||||
|
with open(apkfile, 'w') as fp:
|
||||||
|
fp.write('this is not a zip file')
|
||||||
|
with self.assertRaises(fdroidserver.exception.BuildException):
|
||||||
|
fdroidserver.update.scan_apk(apkfile)
|
||||||
|
|
||||||
def test_process_apk(self):
|
def test_process_apk(self):
|
||||||
|
|
||||||
def _build_yaml_representer(dumper, data):
|
def _build_yaml_representer(dumper, data):
|
||||||
|
Loading…
Reference in New Issue
Block a user