mirror of https://github.com/MISP/MISP
fix: [galaxy:add] Prevent bug when submitting empty galaxy
parent
fb05bc7ab0
commit
38fef5d1ae
|
@ -298,13 +298,13 @@ class GalaxiesController extends AppController
|
|||
$target_id_list = array($target_id);
|
||||
}
|
||||
$cluster_ids = $this->request->data['Galaxy']['target_ids'];
|
||||
if (!empty($cluster_ids)) {
|
||||
if (strlen($cluster_ids) > 0) {
|
||||
$cluster_ids = json_decode($cluster_ids, true);
|
||||
if ($cluster_ids === null) {
|
||||
return new CakeResponse(array('body'=> json_encode(array('saved' => false, 'error' => __('Failed to parse request.'))), 'status'=>200, 'type' => 'json'));
|
||||
if ($cluster_ids === null || empty($cluster_ids)) {
|
||||
return new CakeResponse(array('body'=> json_encode(array('saved' => false, 'errors' => __('Failed to parse request or no clusters picked.'))), 'status'=>200, 'type' => 'json'));
|
||||
}
|
||||
} else {
|
||||
return new CakeResponse(array('body'=> json_encode(array('saved' => false, 'error' => __('No clusters picked.'))), 'status'=>200, 'type' => 'json'));
|
||||
return new CakeResponse(array('body'=> json_encode(array('saved' => false, 'errors' => __('Failed to parse request.'))), 'status'=>200, 'type' => 'json'));
|
||||
}
|
||||
$result = "";
|
||||
if (!is_array($cluster_ids)) { // in case we only want to attach 1
|
||||
|
|
|
@ -3746,6 +3746,7 @@ function addGalaxyListener(id) {
|
|||
}
|
||||
|
||||
function quickSubmitGalaxyForm(cluster_ids, additionalData) {
|
||||
cluster_ids = cluster_ids === null ? [] : cluster_ids;
|
||||
var target_id = additionalData['target_id'];
|
||||
var scope = additionalData['target_type'];
|
||||
var local = additionalData['local'];
|
||||
|
|
Loading…
Reference in New Issue