From 9057123d6d759ff135ce2e2a32c8acc40879c986 Mon Sep 17 00:00:00 2001 From: iglocska Date: Wed, 17 Oct 2018 20:38:24 +0200 Subject: [PATCH] fix: [API] Handle multiple event IDs being queries or not using the event ID filter when generating the CSV output file names --- app/Controller/EventsController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php index 2ae306c47..2ac68ec8e 100644 --- a/app/Controller/EventsController.php +++ b/app/Controller/EventsController.php @@ -2716,7 +2716,11 @@ class EventsController extends AppController if ($user === false) { return $exception; } - $filename = 'misp.csv.event' . $eventid . '.csv'; + if (!empty($eventid) && !is_array($eventid)) { + $filename = 'misp.csv.event' . $eventid . '.csv'; + } else { + $filename = 'misp.csv.filtered_results.csv'; + } $final = $this->Event->restSearch($user, 'csv', $filters); // if it's a search, grab the attributeIDList from the session and get the IDs from it. Use those as the condition