Add attribute.

Add attribute, do not fill in any, and hit Submit, did give error
messages.
pull/61/head
noud 2012-08-24 14:09:17 +02:00
parent 4cec4e69f9
commit ea5ea121e3
2 changed files with 5 additions and 1 deletions

View File

@ -76,7 +76,7 @@ class AttributesController extends AppController {
// Give error if someone tried to submit a attribute with attachment or malware-sample type.
// TODO change behavior attachment options - this is bad ... it should rather by a messagebox or should be filtered out on the view level
if($this->Attribute->typeIsAttachment($this->request->data['Attribute']['type'])) {
if(isset($this->request->data['Attribute']['type']) && $this->Attribute->typeIsAttachment($this->request->data['Attribute']['type'])) {
$this->Session->setFlash(__('Attribute has not been added: attachments are added by "Add attachment" button', true), 'default', array(), 'error');
$this->redirect(array('controller' => 'events', 'action' => 'view', $this->request->data['Attribute']['event_id']));
}

View File

@ -342,6 +342,10 @@ IF (Attribute.category="External analysis", "j", "k"))))))))))'
// remove leading and trailing blanks
$this->data['Attribute']['value'] = trim($this->data['Attribute']['value']);
if (!isset($this->data['Attribute']['type'])) {
return false;
}
switch($this->data['Attribute']['type']) {
// lowercase these things
case 'md5':