mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 06:45:08 +00:00
add content type pdf/html for uploads to s3
This commit is contained in:
@@ -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(
|
||||
@@ -49,4 +56,4 @@ def get_s3_object_path(output_directory: str) -> str:
|
||||
if "prowler/" in bucket_remote_dir: # Check if it is not a custom directory
|
||||
bucket_remote_dir = bucket_remote_dir.partition("prowler/")[-1]
|
||||
|
||||
return bucket_remote_dir
|
||||
return bucket_remote_dir
|
||||
Reference in New Issue
Block a user