Open
Description
Originally posted by @rdbisme in #80 (comment)
I have also another problem, but not sure if it's something that requires an additional issue.
import os
import boto3
from upath import UPath
# Mocked AWS Credentials for moto
os.environ["AWS_ACCESS_KEY_ID"] = "testing"
os.environ["AWS_SECRET_ACCESS_KEY"] = "testing"
os.environ["AWS_SESSION_TOKEN"] = "testing"
conn = boto3.resource(
"s3", region_name="us-east-1", endpoint_url="http://localhost:5000"
)
conn.create_bucket(Bucket="mybucket")
conn.Object("mybucket", "//key").put(Body=b"Something")
up = UPath("s3://mybucket", endpoint_url="http://localhost:5000")
print([f for f in up.rglob("*")])
file = next(up.rglob("*"))
print(file.is_file())
print(file.is_dir())
print(file.exists())
[S3Path('s3://mybucket/key')]
False
False
False
The double slash is being "merged" in one, and creates a weird ghost file.
Doing manually UPath("s3://bucket//key")
works as expected instead.