From 08edba87e6e25fdccd0a196df9139a5a6068eef1 Mon Sep 17 00:00:00 2001 From: iglocska Date: Thu, 19 Dec 2019 16:17:05 +0100 Subject: [PATCH] fix: [STIX] import fixed ________________ ___/-\___ ___/-\___ ___/-\___ / / || |---------| |---------| |---------| / / || | | | | | | | | | | / / __|| | STIX | | | | | | | | | | | / / \\ I || | | | | | | | | | | | | (-------------------|| | | | | | | | | | | | | | | | || == || |_______| |_______| |_______| || TAXII | ============================================= || ____ | ____ | ( | o / ____ \ / ____ \ |) || / / . . \ \ / / . . \ \ | [ |_____| | . . | |____________________________| | . . | |__] | . . | | . . | \_____/ -cfbd- \_____/ --- app/Controller/EventsController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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";