validate appid when reading metadata files

The metadata file must be named after the Application ID of the app it is
describing, and Android Application IDs must be valid Java Package Names.
This commit is contained in:
Hans-Christoph Steiner 2018-09-01 12:08:37 +02:00
parent 3011953d0e
commit 5d161cc9fd
3 changed files with 32 additions and 3 deletions

View file

@ -805,6 +805,9 @@ def read_metadata(xref=True, check_vcs=[], refresh=True, sort_by_time=False):
if metadatapath == '.fdroid.txt':
warn_or_exception(_('.fdroid.txt is not supported! Convert to .fdroid.yml or .fdroid.json.'))
appid, _ignored = fdroidserver.common.get_extension(os.path.basename(metadatapath))
if appid != '.fdroid' and not fdroidserver.common.is_valid_package_name(appid):
warn_or_exception(_("{appid} from {path} is not a valid Java Package Name!")
.format(appid=appid, path=metadatapath))
if appid in apps:
warn_or_exception(_("Found multiple metadata files for {appid}")
.format(appid=appid))