drivendataorg / drivendataorg/cloudpathlib

is_dir() and is_file() are not working properly for gs

Open
#493 7 comments 0 reactions 0 assignees View on GitHub
design decision GCP
Dominant language
Python
Stars
628
Forks
88
Avg merge
17h 28m
Merged PRs (30d)
2

Description

Hey,
I tried to use the `is_dir` and `is_file` functions from both s3 and gs, but discovered that:
```
from cloudpathlib import AnyPath

p1 = AnyPath("gs://my-bucket/test/test_dir")
p2 = AnyPath("gs://my-bucket/test/test_dir/")

print(p1.is_dir()) # True
print(p2.is_dir()) # False

p1 = AnyPath("s3://my-bucket/test/test_dir")
p2 = AnyPath("s3://my-bucket/test/test_dir/")

print(p1.is_dir()) # True
print(p2.is_dir()) # True
```

looks like in gs everything is classified as a file unless I strip the last "/".
Any Idea why is this happening?
using `cloudpathlib==0.20.0`

Thanks in advance

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.