From 5530125d80b9749b9ad1682c71c9704493097131 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Wed, 13 Mar 2019 13:33:55 +0200 Subject: [PATCH] remote: s3: account for empty pages --- dvc/remote/s3.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dvc/remote/s3.py b/dvc/remote/s3.py index 6574d7e68..8e7f20b7f 100644 --- a/dvc/remote/s3.py +++ b/dvc/remote/s3.py @@ -136,7 +136,10 @@ class RemoteS3(RemoteBase): list_objects_api = "list_objects_v2" paginator = s3.get_paginator(list_objects_api) for page in paginator.paginate(**kwargs): - for item in page["Contents"]: + contents = page.get("Contents", None) + if not contents: + continue + for item in contents: yield item["Key"] def list_cache_paths(self):