From 46440d38943dad79cf80e87dcab7cc0d72ff9cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20R=C3=ADos?= Date: Wed, 23 Feb 2022 19:26:35 -0300 Subject: [PATCH] fix: check if s3 object is a directory by checking the start of the object ContentType property --- build/frappe-worker/commands/push_backup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/frappe-worker/commands/push_backup.py b/build/frappe-worker/commands/push_backup.py index 78337ade..cd04fe93 100644 --- a/build/frappe-worker/commands/push_backup.py +++ b/build/frappe-worker/commands/push_backup.py @@ -75,7 +75,7 @@ def delete_old_backups(limit, bucket, site_name): for obj in objects.get("CommonPrefixes"): if obj.get("Prefix") == bucket_dir + "/": for backup_obj in bucket.objects.filter(Prefix=obj.get("Prefix")): - if backup_obj.get()["ContentType"] == "application/x-directory": + if backup_obj.get()["ContentType"].startswith("application/x-directory"): continue try: # backup_obj.key is bucket_dir/site/date_time/backupfile.extension