mirror of https://github.com/MISP/MISP
fix: [STIX] import fixed
________________ ___/-\___ ___/-\___ ___/-\___ / / || |---------| |---------| |---------| / / || | | | | | | | | | | / / __|| | STIX | | | | | | | | | | | / / \\ I || | | | | | | | | | | | | (-------------------|| | | | | | | | | | | | | | | | || == || |_______| |_______| |_______| || TAXII | ============================================= || ____ | ____ | ( | o / ____ \ / ____ \ |) || / / . . \ \ / / . . \ \ | [ |_____| | . . | |____________________________| | . . | |__] | . . | | . . | \_____/ -cfbd- \_____/pull/5488/head
parent
53482ff76c
commit
08edba87e6
|
@ -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";
|
||||
|
|
Loading…
Reference in New Issue