osclib/origin: require origin key in origin_annotation_load().

Alternatively, this can validate something like "ok: not handled".
This commit is contained in:
Jimmy Berry 2019-11-01 14:07:45 -05:00
parent 2ecb8ce3d7
commit a724dcfa9d

View File

@ -337,8 +337,9 @@ def origin_annotation_load(request, action, user):
comment_stripped = re.sub(r'^ ', '', review.comment, flags=re.MULTILINE)
annotation = yaml.safe_load(comment_stripped)
if not annotation or type(annotation) is not dict:
# Only returned structured data (ie. dict), otherwise None.
if not annotation or type(annotation) is not dict or 'origin' not in annotation:
# Only returned structured data (ie. dict) with a minimum of the origin
# key available, otherwise None.
return None
if len(request.actions) > 1: