fix: allow import of json event without the key

pull/9255/head
Luciano Righetti 2023-08-16 13:29:30 +02:00
parent cbaef0c37a
commit 6c82021261
1 changed files with 3 additions and 0 deletions

View File

@ -3573,6 +3573,9 @@ class Event extends AppModel
if (isset($dataArray['Event'])) {
$dataArray['response']['Event'] = $dataArray['Event'];
unset($dataArray['Event']);
} else {
// Accept an event not containing the `Event` key
$dataArray['response']['Event'] = $dataArray;
}
if (!isset($dataArray['response']) || !isset($dataArray['response']['Event'])) {
$exception = $isXml ? __('This is not a valid MISP XML file.') : __('This is not a valid MISP JSON file.');