1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-08-29 08:30:53 +00:00
This commit is contained in:
Michael Meidlinger 2024-01-10 10:20:37 -08:00 committed by GitHub
commit f713ffa923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -511,10 +511,13 @@ def list_target_files(config):
# connect to the region & bucket
try:
s3 = boto3.client('s3', \
endpoint_url=f'https://{target.hostname}', \
aws_access_key_id=config['target_user'], \
aws_secret_access_key=config['target_pass'])
if config['target_user'] == "" and config['target_pass'] == "":
s3 = boto3.client('s3', endpoint_url=f'https://{target.hostname}')
else:
s3 = boto3.client('s3', \
endpoint_url=f'https://{target.hostname}', \
aws_access_key_id=config['target_user'], \
aws_secret_access_key=config['target_pass'])
bucket_objects = s3.list_objects_v2(Bucket=bucket, Prefix=path)['Contents']
backup_list = [(key['Key'][len(path):], key['Size']) for key in bucket_objects]
except ClientError as e: