From 5b3b52752de5b4edca796c33d9dfd46b99c24a82 Mon Sep 17 00:00:00 2001 From: Jon Beilke Date: Thu, 4 Oct 2018 10:25:16 -0500 Subject: [PATCH] explicitly check that lifecycle actions are not None when setting lifecycle --- moto/s3/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/moto/s3/models.py b/moto/s3/models.py index 39f36982..bb4d7848 100644 --- a/moto/s3/models.py +++ b/moto/s3/models.py @@ -424,14 +424,14 @@ class FakeBucket(BaseModel): transition = rule.get('Transition') nve_noncurrent_days = None - if rule.get('NoncurrentVersionExpiration'): + if rule.get('NoncurrentVersionExpiration') is not None: if rule["NoncurrentVersionExpiration"].get('NoncurrentDays') is None: raise MalformedXML() nve_noncurrent_days = rule["NoncurrentVersionExpiration"]["NoncurrentDays"] nvt_noncurrent_days = None nvt_storage_class = None - if rule.get('NoncurrentVersionTransition'): + if rule.get('NoncurrentVersionTransition') is not None: if rule["NoncurrentVersionTransition"].get('NoncurrentDays') is None: raise MalformedXML() if rule["NoncurrentVersionTransition"].get('StorageClass') is None: @@ -440,7 +440,7 @@ class FakeBucket(BaseModel): nvt_storage_class = rule["NoncurrentVersionTransition"]["StorageClass"] aimu_days = None - if rule.get('AbortIncompleteMultipartUpload'): + if rule.get('AbortIncompleteMultipartUpload') is not None: if rule["AbortIncompleteMultipartUpload"].get('DaysAfterInitiation') is None: raise MalformedXML() aimu_days = rule["AbortIncompleteMultipartUpload"]["DaysAfterInitiation"]