Fix for whitespace in keys, refs #83

pull/84/head
Simon Willison 2023-04-30 14:59:46 -07:00
rodzic 20b4545ad1
commit 3c05be4375
1 zmienionych plików z 2 dodań i 0 usunięć

Wyświetl plik

@ -1387,6 +1387,8 @@ def delete_objects(bucket, keys, prefix, silent, dry_run, **boto_options):
click.echo(key)
return
for batch in batches(keys, 1000):
# Remove any rogue \r characters:
batch = [k.strip() for k in batch]
response = s3.delete_objects(
Bucket=bucket, Delete={"Objects": [{"Key": key} for key in batch]}
)