Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/cloudstorage/drivers/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ def get_blob(self, container: Container, blob_name: str) -> Blob:

def get_blobs(self, container: Container) -> Iterable[Blob]:
container_path = self._get_folder_path(container, validate=True)

for folder, sub_folders, files in os.walk(container_path, topdown=True):
# Remove unwanted sub-folders
for sub_folder in IGNORE_FOLDERS:
Expand All @@ -549,7 +548,7 @@ def get_blobs(self, container: Container) -> Iterable[Blob]:
full_path = os.path.join(folder, name)
if not self._check_path_accessible(full_path):
continue
object_name = pathlib.Path(full_path).name
object_name = pathlib.Path(full_path).relative_to(container.cdn_url).as_posix()
yield self._make_blob(container, object_name)

def download_blob(self, blob: Blob, destination: FileLike) -> None:
Expand Down
10 changes: 10 additions & 0 deletions tests/test_drivers_local.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import io
import os
import shutil
import multiprocessing as mp
Expand Down Expand Up @@ -142,6 +143,15 @@ def test_container_get_blob(container, text_blob):
assert text_get_blob == text_blob


def test_container_get_blobs(container):
container.upload_blob(
io.BytesIO(b'Hello'),
blob_name='some/where/hello.txt'
)

assert [blob.name for blob in container] == ['some/where/hello.txt']


def test_container_get_blob_invalid(container):
blob_name = random_container_name()

Expand Down