mirror of https://github.com/MISP/MISP
fix: [API] taxonomy/addTag now correctly responds if queried via the API instead of redirecting, fixes #4865
parent
e60f0beff9
commit
b2e9bbd7ef
|
@ -262,9 +262,17 @@ class TaxonomiesController extends AppController
|
|||
$result = $this->Taxonomy->addTags($this->request->data['Tag']['taxonomy_id'], $this->request->data['Tag']['nameList']);
|
||||
}
|
||||
if ($result) {
|
||||
$this->Flash->success(__('The tag(s) has been saved.'));
|
||||
$message = __('The tag(s) has been saved.');
|
||||
if ($this->_isRest()) {
|
||||
return $this->RestResponse->saveSuccessResponse('Taxonomy', 'addTag', $taxonomy_id, $this->response->type(), $message);
|
||||
}
|
||||
$this->Flash->success($message);
|
||||
} else {
|
||||
$this->Flash->error(__('The tag(s) could not be saved. Please, try again.'));
|
||||
$message = __('The tag(s) could not be saved. Please, try again.');
|
||||
if ($this->_isRest()) {
|
||||
return $this->RestResponse->saveFailResponse('Taxonomy', 'addTag', $taxonomy_id, $message, $this->response->type());
|
||||
}
|
||||
$this->Flash->error($message);
|
||||
}
|
||||
$this->redirect($this->referer());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue