metadata: parsed srclibs must always return a dict as the container

This commit is contained in:
Hans-Christoph Steiner 2020-05-14 15:02:19 +02:00
parent 410901d3bd
commit a0e3b01e94
2 changed files with 16 additions and 0 deletions

View file

@ -763,6 +763,9 @@ def parse_yaml_srclib(metadatapath):
with open(metadatapath, "r", encoding="utf-8") as f:
try:
data = yaml.load(f, Loader=SafeLoader)
if type(data) is not dict:
raise yaml.error.YAMLError(_('{file} is blank or corrupt!')
.format(file=metadatapath))
except yaml.error.YAMLError as e:
warn_or_exception(_("Invalid srclib metadata: could not "
"parse '{file}'")