Skip to content

Commit deee239

Browse files
kyhaubchew
authored andcommitted
Minor fix in do_get_s3_archive (#49)
Fixed a potential bug in do_get_s3_archive and added Prefix when calling s3.list_objects_v2
1 parent 3a001ce commit deee239

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dynamodump.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def do_get_s3_archive(profile, region, bucket, table, archive):
178178
try:
179179
contents = s3.list_objects_v2(
180180
Bucket=bucket,
181+
Prefix=args.dumpPath
181182
)
182183
except botocore.exceptions.ClientError as e:
183184
logging.exception("Issue listing contents of bucket " + bucket + "\n\n" + str(e))
@@ -187,7 +188,7 @@ def do_get_s3_archive(profile, region, bucket, table, archive):
187188
# Therefore, just get item from bucket based on table name since that's what we name the files.
188189
filename = None
189190
for d in contents["Contents"]:
190-
if d["Key"] == "dump/{}.{}".format(table, archive_type):
191+
if d["Key"] == "{}/{}.{}".format(args.dumpPath, table, archive_type):
191192
filename = d["Key"]
192193

193194
if not filename:

0 commit comments

Comments
 (0)