Working on range request and seeking for file downloads and streaming
This commit is contained in:
@@ -201,10 +201,10 @@ async def download_hosted_file(
|
||||
log.info(f'Full file path with subdirectory: {file_path_w_subdir}')
|
||||
|
||||
if os.path.exists(file_path_w_subdir):
|
||||
# log.info('Hosted file found on server.')
|
||||
# return FileResponse(file_path_w_subdir, filename=filename)
|
||||
|
||||
log.info('Hosted file found on server.')
|
||||
return FileResponse(file_path_w_subdir, filename=filename)
|
||||
|
||||
# log.info('Hosted file found on server.')
|
||||
# if streaming:
|
||||
# log.warning('Streaming!!!')
|
||||
# def iterfile(): #
|
||||
@@ -212,8 +212,6 @@ async def download_hosted_file(
|
||||
# yield from file_like #
|
||||
# return StreamingResponse(iterfile(), media_type='video/mp4')
|
||||
# else:
|
||||
|
||||
return FileResponse(file_path_w_subdir, filename=filename)
|
||||
else:
|
||||
log.error(f'The hosted file was not found on the server. Hash: {hash_sha256}')
|
||||
return mk_resp(data=None, status_code=404, response=commons.response, status_message=f'The hosted file was not found on the server. Hash: {hash_sha256}') # Not Found
|
||||
|
||||
Reference in New Issue
Block a user