diff --git a/moto/s3/responses.py b/moto/s3/responses.py index eb21e6710..3a0df6987 100644 --- a/moto/s3/responses.py +++ b/moto/s3/responses.py @@ -1347,7 +1347,7 @@ class ResponseObject(_TemplateEnvironmentMixin, ActionAuthenticatorMixin): max_parts=max_parts, ) next_part_number_marker = parts[-1].name if parts else 0 - is_truncated = parts and self.backend.is_truncated( + is_truncated = len(parts) != 0 and self.backend.is_truncated( bucket_name, upload_id, next_part_number_marker ) diff --git a/tests/test_s3/test_s3_multipart.py b/tests/test_s3/test_s3_multipart.py index b61ad0c66..38cb5c04c 100644 --- a/tests/test_s3/test_s3_multipart.py +++ b/tests/test_s3/test_s3_multipart.py @@ -107,6 +107,21 @@ def test_multipart_upload_should_return_part_10000(): part_nrs.should.equal([1, 2, 10000]) +@mock_s3 +def test_multipart_upload_without_parts(): + bucket = "dummybucket" + s3_client = boto3.client("s3", "us-east-1") + + key = "test_file" + s3_client.create_bucket(Bucket=bucket) + + mpu = s3_client.create_multipart_upload(Bucket=bucket, Key=key) + mpu_id = mpu["UploadId"] + + list_parts_result = s3_client.list_parts(Bucket=bucket, Key=key, UploadId=mpu_id) + list_parts_result["IsTruncated"].should.equal(False) + + @mock_s3 @pytest.mark.parametrize("part_nr", [10001, 10002, 20000]) def test_s3_multipart_upload_cannot_upload_part_over_10000(part_nr):