Skip to content

Commit

Permalink
Updates to upload_evidence parameters
Browse files Browse the repository at this point in the history
The API library handles reading the file data and setting the content
type.
  • Loading branch information
jleaniz committed Oct 5, 2023
1 parent 17167bd commit 8e2b5ee
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions turbinia/api/cli/turbinia_client/core/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,18 +494,12 @@ def upload_evidence(
log.error(error_message)
continue
abs_path = os.path.abspath(file_path)
with open(file_path, 'rb') as f:
filename = os.path.basename(f.name)
filedata = f.read()
mimetype = (
mimetypes.guess_type(filename)[0] or 'application/octet-stream')
upload_file = tuple([filename, filedata, mimetype])
except OSError:
log.error(f'Unable to read file in {file_path}')
continue
try:
api_response = api_instance.upload_evidence(
upload_file, ticket_id, calculate_hash)
api_response = api_instance.upload_evidence([file_path], ticket_id,
calculate_hash)
report[abs_path] = api_response
except exceptions.ApiException as exception:
error_message = (
Expand Down

0 comments on commit 8e2b5ee

Please sign in to comment.