Skip to content

Commit

Permalink
yapf
Browse files Browse the repository at this point in the history
  • Loading branch information
hacktobeer committed Aug 6, 2024
1 parent aeee436 commit 7711ab7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions turbinia/api/routes/evidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ async def upload_file(
file_info['hash'] = sha_hash.hexdigest()
return file_info


@router.get('/download/{file_path:path}')
async def download_evidence(request: Request, file_path):
"""Downloads evidence file path.
Expand All @@ -125,15 +126,15 @@ async def download_evidence(request: Request, file_path):
# check if file exists
configured_output_path = turbinia_config.OUTPUT_DIR
abspath = os.path.abspath(file_path)
if configured_output_path != os.path.commonpath((configured_output_path, abspath)) or not os.path.isfile(abspath):
if configured_output_path != os.path.commonpath(
(configured_output_path, abspath)) or not os.path.isfile(abspath):
raise HTTPException(
status_code=404,
detail='File path: access denied or file does not exist')

return FileResponse(file_path)



@router.get('/types')
async def get_evidence_types(request: Request):
"""Returns supported Evidence object types and required parameters."""
Expand Down

0 comments on commit 7711ab7

Please sign in to comment.