fix: Do not fail on MISP export if there are no redirects

pull/145/head
Raphaël Vinot 2020-12-24 15:43:44 +01:00
parent 3b8b3faff4
commit 7241ae2ea1
1 changed files with 6 additions and 5 deletions

View File

@ -924,11 +924,12 @@ class Lookyloo():
initial_url = URLObject(cache["url"]) # type: ignore initial_url = URLObject(cache["url"]) # type: ignore
redirects = [URLObject(url) for url in cache['redirects']] # type: ignore redirects = [URLObject(url) for url in cache['redirects']] # type: ignore
initial_url.add_reference(redirects[0], 'redirects-to') if redirects:
prec_object = redirects[0] initial_url.add_reference(redirects[0], 'redirects-to')
for u_object in redirects[1:]: prec_object = redirects[0]
prec_object.add_reference(u_object, 'redirects-to') for u_object in redirects[1:]:
prec_object = u_object prec_object.add_reference(u_object, 'redirects-to')
prec_object = u_object
event.add_object(initial_url) event.add_object(initial_url)
for u_object in redirects: for u_object in redirects: