fix: /attributes/text should allow more than one type to be downloaded

- simply pass something such as:

{
  "type": ["ip-src", "ip-dst"]
}
pull/2985/head
iglocska 2018-02-28 23:44:56 +01:00
parent 7e5cf3ee83
commit c7907bf45a
2 changed files with 2 additions and 2 deletions

View File

@ -2117,7 +2117,7 @@ class AttributesController extends AppController {
}
}
$this->response->type('txt'); // set the content type
$this->header('Content-Disposition: download; filename="misp.' . $type . '.txt"');
$this->header('Content-Disposition: download; filename="misp.' . (is_array($type) ? 'multi' : $type) . '.txt"');
$this->layout = 'text/default';
$attributes = $this->Attribute->text($this->Auth->user(), $type, $tags, $eventId, $allowNonIDS, $from, $to, $last, $enforceWarninglist, $allowNotPublished);
$this->loadModel('Whitelist');

View File

@ -1902,7 +1902,7 @@ class Attribute extends AppModel {
$conditions['AND']['Attribute.to_ids'] = 1;
if ($allowNotPublished === false) $conditions['AND']['Event.published'] = 1;
}
if ($type !== 'all') $conditions['AND']['Attribute.type'] = $type;
if (!is_array($type) && $type !== 'all') $conditions['AND']['Attribute.type'] = $type;
if ($from) $conditions['AND']['Event.date >='] = $from;
if ($to) $conditions['AND']['Event.date <='] = $to;
if ($last) $conditions['AND']['Event.publish_timestamp >='] = $last;