Check that ValueFlows attachments have names

main
Bob Mottram 2023-08-24 11:27:20 +01:00
parent fa3283a867
commit 5e6e282b9b
1 changed files with 5 additions and 2 deletions

View File

@ -2228,10 +2228,13 @@ def _is_valueflows_attachment(attach_item: {}) -> bool:
"""Returns true if the given item is a ValueFlows entry
within the actor attachment list
"""
if 'rel' in attach_item and 'href' in attach_item:
if 'rel' in attach_item and \
'href' in attach_item and \
'name' in attach_item:
if isinstance(attach_item['rel'], list) and \
isinstance(attach_item['name'], str) and \
isinstance(attach_item['href'], str):
if len(attach_item['rel']) == 2:
if len(attach_item['rel']) == 2 and len(attach_item['name'] > 1):
if attach_item['rel'][0] == 'payment' and \
attach_item['rel'][1].endswith('/valueflows/Proposal'):
return True