From: Dmitriy Bogdanov Date: Thu, 18 Feb 2016 12:40:51 +0000 (+0400) Subject: Fix update crash in case of unset dates in APK X-Git-Tag: 0.7.0~104^2~2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a8b1472a43c7cee4cac3e9da6e89d39636de296f;p=fdroidserver.git Fix update crash in case of unset dates in APK --- diff --git a/fdroidserver/update.py b/fdroidserver/update.py index aa9a9a3b..180ddcc9 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -568,12 +568,16 @@ def scan_apks(apps, apkcache, repodir, knownapks): # has to be more than 24 hours newer because ZIP/APK files do not # store timezone info manifest = apkzip.getinfo('AndroidManifest.xml') - dt_obj = datetime(*manifest.date_time) - checkdt = dt_obj - timedelta(1) - if datetime.today() < checkdt: - logging.warn('System clock is older than manifest in: ' - + apkfilename + '\nSet clock to that time using:\n' - + 'sudo date -s "' + str(dt_obj) + '"') + if manifest.date_time[1] == 0: # month can't be zero + logging.debug('AndroidManifest.xml has no date') + else: + dt_obj = datetime(*manifest.date_time) + checkdt = dt_obj - timedelta(1) + if datetime.today() < checkdt: + logging.warn('System clock is older than manifest in: ' + + apkfilename + + '\nSet clock to that time using:\n' + + 'sudo date -s "' + str(dt_obj) + '"') iconfilename = "%s.%s.png" % ( apk['id'],