Work on event launcher, files, and related

This commit is contained in:
Scott Idem
2022-03-08 18:31:31 -05:00
parent 398ef69ff7
commit 0947032a94

View File

@@ -163,13 +163,20 @@ async def download_event_file(
hash_sha256 = event_file_obj.hosted_file.hash_sha256
hash_filename = hash_sha256+'.file'
if subdir_path:
full_subdirectory_path = os.path.join(hosted_files_path, subdir_path)
else:
full_subdirectory_path = hosted_files_path
log.debug(full_subdirectory_path)
pathlib.Path(full_subdirectory_path).mkdir(parents=True, exist_ok=True)
file_path_w_subdir = os.path.join(full_subdirectory_path, hash_filename)
log.info(f'Full file path with subdirectory: {file_path_w_subdir}')
if os.path.exists(file_path_w_subdir):
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=False, status_code=400, response=commons.response, status_message='The hosted file was not found on the server.') # Bad Request
# ### END ### API Hosted File ### download_tmp() ###