diff --git a/api/api.py b/api/api.py index 87ea94bc379aea681c4c96609f208da14ebd2ca4..881cb03e1cf90e0301e00f8faf10f34e3c39ca3e 100644 --- a/api/api.py +++ b/api/api.py @@ -189,8 +189,8 @@ routes = [ listhandler.AnalysesHandler, handler_method='download', methods=['GET'], name='analysis_files'), webapp2.Route(_format(r'/api/<cont_name:{cont_name_re}>/<cid:{cid_re}>/<list_name:analyses>/<_id:{cid_re}>/files/<name:{filename_re}>'), - listhandler.AnalysesHandler, - handler_method='download', name='analysis_single_file'), + listhandler.AnalysesHandler, handler_method='download', + methods=['GET'], name='analysis_single_file'), webapp2.Route(_format(r'/api/<cont_name:{cont_name_re}>/<cid:{cid_re}>/<list_name:analyses>/<_id:{cid_re}>/notes'), listhandler.AnalysesHandler, handler_method='add_note', methods=['POST'], name='analysis_add_note'), diff --git a/api/handlers/listhandler.py b/api/handlers/listhandler.py index d36aba43a9182b3168649799e2ef57965b9d9c00..dafc6284b995d9274d985504a2c8dcbb4c6d6e17 100644 --- a/api/handlers/listhandler.py +++ b/api/handlers/listhandler.py @@ -835,8 +835,10 @@ class AnalysesHandler(ListHandler): permchecker, storage, _, _, _ = self._initialize_request(cont_name, list_name, _id) filename = kwargs.get('name') ticket_id = self.get_param('ticket') - if not ticket_id: + if ticket_id is None: permchecker(noop)('GET', _id=_id) + elif ticket_id != '': + ticket = self._check_ticket(ticket_id, _id, filename) analysis_id = kwargs.get('_id') fileinfo = storage.get_fileinfo(_id, analysis_id, filename) if fileinfo is None: @@ -844,7 +846,7 @@ class AnalysesHandler(ListHandler): if filename: error_msg = 'Could not find file {} on analysis {}'.format(filename, analysis_id) self.abort(404, error_msg) - if not ticket_id: + if ticket_id == '': if filename: total_size = fileinfo[0]['size'] file_cnt = 1 @@ -860,7 +862,6 @@ class AnalysesHandler(ListHandler): 'filename': filename } else: - ticket = self._check_ticket(ticket_id, _id, filename) if not filename: self._send_batch(ticket) return