add content type pdf/html for uploads to s3

This commit is contained in:
greg
2024-03-12 02:15:08 -07:00
parent 8242a882a3
commit d3f19053f2

View File

@@ -36,7 +36,14 @@ def send_to_s3_bucket(
object_name = bucket_directory + "/" + output_mode + "/" + filename
s3_client = audit_session.client("s3")
s3_client.upload_file(file_name, output_bucket_name, object_name)
extra_args = {}
if filename.endswith('.html'):
extra_args['ContentType'] = 'text/html'
elif filename.endswith('.pdf'):
extra_args['ContentType'] = 'application/pdf'
s3_client.upload_file(file_name, output_bucket_name, object_name, ExtraArgs=extra_args)
except Exception as error:
logger.error(