From: Hans-Christoph Steiner Date: Wed, 23 Mar 2016 20:04:20 +0000 (+0100) Subject: check whether metadata file is a duplicate before parsing it X-Git-Tag: 0.7.0~44^2~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=fdroidserver.git;a=commitdiff_plain;h=400acdefabceab83d0eed96c4cf7d905a014751e check whether metadata file is a duplicate before parsing it By checking first, this prevents a stacktrace when the duplicate metadata file is not valid. For example, in the tests, the duplicate is just a zero length file, which was causing a stacktrace. --- diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index ded6cd1a..9ba9b1fd 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -783,9 +783,10 @@ def read_metadata(xref=True): + glob.glob('.fdroid.json') + glob.glob('.fdroid.xml') + glob.glob('.fdroid.yml')): + packageName, _ = fdroidserver.common.get_extension(os.path.basename(metadatapath)) + if packageName in apps: + raise MetaDataException("Found multiple metadata files for " + packageName) app = parse_metadata(metadatapath) - if app.id in apps: - raise MetaDataException("Found multiple metadata files for " + app.id) check_metadata(app) apps[app.id] = app