mirror of https://github.com/MISP/PyMISP
Merge pull request #877 from dragsu/feat/exception-when-tag-without-name
Graceful handling of tagging when name attribute is missingpull/898/head
commit
8da684aad3
|
@ -3492,8 +3492,10 @@ class PyMISP:
|
||||||
"""
|
"""
|
||||||
uuid = get_uuid_or_id_from_abstract_misp(misp_entity)
|
uuid = get_uuid_or_id_from_abstract_misp(misp_entity)
|
||||||
if isinstance(tag, MISPTag):
|
if isinstance(tag, MISPTag):
|
||||||
tag = tag.name
|
tag_name = tag.name if 'name' in tag else ""
|
||||||
to_post = {'uuid': uuid, 'tag': tag, 'local': local}
|
else:
|
||||||
|
tag_name = tag
|
||||||
|
to_post = {'uuid': uuid, 'tag': tag_name, 'local': local}
|
||||||
response = self._prepare_request('POST', 'tags/attachTagToObject', data=to_post)
|
response = self._prepare_request('POST', 'tags/attachTagToObject', data=to_post)
|
||||||
return self._check_json_response(response)
|
return self._check_json_response(response)
|
||||||
|
|
||||||
|
@ -3505,8 +3507,7 @@ class PyMISP:
|
||||||
"""
|
"""
|
||||||
uuid = get_uuid_or_id_from_abstract_misp(misp_entity)
|
uuid = get_uuid_or_id_from_abstract_misp(misp_entity)
|
||||||
if isinstance(tag, MISPTag):
|
if isinstance(tag, MISPTag):
|
||||||
if 'name' in tag:
|
tag_name = tag.name if 'name' in tag else ""
|
||||||
tag_name = tag.name
|
|
||||||
else:
|
else:
|
||||||
tag_name = tag
|
tag_name = tag
|
||||||
to_post = {'uuid': uuid, 'tag': tag_name}
|
to_post = {'uuid': uuid, 'tag': tag_name}
|
||||||
|
|
Loading…
Reference in New Issue