diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php index 059ac55c3..1b9e6ad98 100644 --- a/app/Controller/EventsController.php +++ b/app/Controller/EventsController.php @@ -2147,7 +2147,6 @@ class EventsController extends AppController throw new UnauthorizedException(__('You do not have permission to do that.')); } if ($this->request->is('post')) { - $original_file = !empty($this->data['Event']['original_file']) ? $this->data['Event']['stix']['name'] : ''; if ($this->_isRest()) { $randomFileName = $this->Event->generateRandomFileName(); $tmpDir = APP . "files" . DS . "scripts" . DS . "tmp"; @@ -2158,8 +2157,8 @@ class EventsController extends AppController $this->Auth->user(), $randomFileName, $stix_version, - $original_file, - $this->data['Event']['publish'] + 'uploaded_stix_file.' . ($stix_version == '1' ? 'xml' : 'json'), + false ); if (is_array($result)) { return $this->RestResponse->saveSuccessResponse('Events', 'upload_stix', false, $this->response->type(), 'STIX document imported, event\'s created: ' . implode(', ', $result) . '.'); @@ -2174,6 +2173,7 @@ class EventsController extends AppController return $this->RestResponse->saveFailResponse('Events', 'upload_stix', false, $result, $this->response->type()); } } else { + $original_file = !empty($this->data['Event']['original_file']) ? $this->data['Event']['stix']['name'] : ''; if (isset($this->data['Event']['stix']) && $this->data['Event']['stix']['size'] > 0 && is_uploaded_file($this->data['Event']['stix']['tmp_name'])) { $randomFileName = $this->Event->generateRandomFileName(); $tmpDir = APP . "files" . DS . "scripts" . DS . "tmp";