mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 06:52:39 +03:00
update: do not crash if AndroidManifest.xml in APK has invalid date
This crash actually blocked a Janus exploit APK from being added to the repo, but crashing isn't really the appropriate way to do that.
This commit is contained in:
parent
8f45796ecb
commit
42522c23c9
1 changed files with 7 additions and 4 deletions
|
@ -1355,10 +1355,13 @@ def process_apk(apkcache, apkfilename, repodir, knownapks, use_date_from_apk=Fal
|
||||||
apkzip = zipfile.ZipFile(apkfile, 'r')
|
apkzip = zipfile.ZipFile(apkfile, 'r')
|
||||||
|
|
||||||
manifest = apkzip.getinfo('AndroidManifest.xml')
|
manifest = apkzip.getinfo('AndroidManifest.xml')
|
||||||
if manifest.date_time[1] == 0: # month can't be zero
|
# 1980-0-0 means zeroed out, any other invalid date should trigger a warning
|
||||||
logging.debug(_('AndroidManifest.xml has no date'))
|
if (1980, 0, 0) != manifest.date_time[0:3]:
|
||||||
else:
|
try:
|
||||||
common.check_system_clock(datetime(*manifest.date_time), apkfilename)
|
common.check_system_clock(datetime(*manifest.date_time), apkfilename)
|
||||||
|
except ValueError as e:
|
||||||
|
logging.warning(_("{apkfilename}'s AndroidManifest.xml has a bad date: ")
|
||||||
|
.format(apkfilename=apkfile) + str(e))
|
||||||
|
|
||||||
# extract icons from APK zip file
|
# extract icons from APK zip file
|
||||||
iconfilename = "%s.%s.png" % (apk['packageName'], apk['versionCode'])
|
iconfilename = "%s.%s.png" % (apk['packageName'], apk['versionCode'])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue