Skip to content

Commit

Permalink
fix(to_local): issue where files without extensions would not be cached
Browse files Browse the repository at this point in the history
 - oops 😅
  • Loading branch information
justindujardin committed Apr 16, 2020
1 parent eb8caa7 commit 3d543a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gcspath/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def to_local(cls, blob_path: Union["GCSPath", str], recurse: bool = True) -> Pat
# If the file isn't in the cache, download it
if not cache_blob.exists():
# Is a blob
if cache_blob.suffix != "":
if blob_path.is_file():
dest_folder = cache_blob.parent
dest_folder.mkdir(exist_ok=True, parents=True)
cache_blob.write_bytes(blob_path.read_bytes())
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_is_path_instance(with_adapter):
@pytest.mark.parametrize("adapter", TEST_ADAPTERS)
def test_path_to_local(with_adapter):
root: GCSPath = GCSPath.from_bucket(bucket) / "to_local"
foo_blob: GCSPath = root / "foo.txt"
foo_blob: GCSPath = root / "foo"
foo_blob.write_text("---")
assert isinstance(foo_blob, GCSPath)
use_fs_cache()
Expand Down

0 comments on commit 3d543a8

Please sign in to comment.