fix: Fixed the downloadSamples API

pull/2639/head
iglocska 2017-11-14 09:54:47 +01:00
parent 27e3faeba5
commit f19a3a7c1b
1 changed files with 3 additions and 3 deletions

View File

@ -2427,8 +2427,7 @@ class AttributesController extends AppController {
if ($allSamples) {
if (empty($validTypes)) {
$error = 'Invalid hash format (valid options are ' . implode(', ', array_keys($this->Attribute->hashTypes)) . ')';
}
else {
} else {
foreach ($validTypes as $t) {
if ($t == 'md5') $types = array_merge($types, array('malware-sample', 'filename|md5', 'md5'));
else $types = array_merge($types, array('filename|' . $t, $t));
@ -2475,7 +2474,8 @@ class AttributesController extends AppController {
array('Attribute.type' => 'malware-sample')
)
),
'contain' => array('Event')
'contain' => array('Event'),
'flatten' => 1
)
);
if (empty($attributes)) $error = 'No hits with the given parameters.';