-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Description
Which operating system and Python version are you using?
Windows 11, Python 3.9.6
Which version of this project are you using?
0.1.4
What did you do?
- Created a UPath from an S3 URI of a bucket with key suffix and trailing slash
- Used the
/operator to create a new S3 path by joining a string to the original UPath
>>> bucket_with_key = UPath('s3://mybucket/withkey/') # created UPath consisting of bucket and key with trailing slash
>>> subpath_new = bucket_with_key / 'subfolder/myfile.txt'
>>> subpath_new
S3Path('s3://mybucket/withkey//subfolder/myfile.txt')
What did you expect to see?
I would expect to see a single slash between s3://mybucket/withkey and subfolder/myfile.txt
What did you see instead?
Resultant S3Path has a double slash: S3Path('s3://mybucket/withkey//subfolder/myfile.txt')
Additional info
This works as expected when I have just a bucket, or if I have bucket and key without a trailing slash
Just a bucket:
>>> from upath import UPath
>>> bucketpath = UPath('s3://mybucket/') # trailing slash with bucket only
>>> subpath = bucketpath / 'subfolder/myfile.txt'
>>> subpath
S3Path('s3://mybucket/subfolder/myfile.txt')
Bucket and key but no trailing slash:
>>> from upath import UPath
>>> bucket_with_key = UPath('s3://mybucket/withkey') # bucket and key but no trailing slash
>>> subpath_new = bucket_with_key / 'subfolder/myfile.txt'
>>> subpath_new
S3Path('s3://mybucket/withkey/subfolder/myfile.txt')
Metadata
Metadata
Assignees
Labels
bug 🐛Something isn't workingSomething isn't working