Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPath handling of paths with double slashes // #144

Open
ap-- opened this issue Sep 16, 2023 · 1 comment
Open

UPath handling of paths with double slashes // #144

ap-- opened this issue Sep 16, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ap--
Copy link
Collaborator

ap-- commented Sep 16, 2023

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.

@ap--
Copy link
Collaborator Author

ap-- commented Sep 16, 2023

Hi @rdbisme

Thanks for reporting! I created a new issue to track this separately. Would you be willing to create a standalone test in upath/tests/implementations/test_s3.py that reproduces this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant