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

Fail to instantiate s3 path with # character in URI #164

Closed
alejoe91 opened this issue Nov 23, 2023 · 2 comments · Fixed by #191
Closed

Fail to instantiate s3 path with # character in URI #164

alejoe91 opened this issue Nov 23, 2023 · 2 comments · Fixed by #191
Assignees
Labels
bug 🐛 Something isn't working
Milestone

Comments

@alejoe91
Copy link

Hi,

When I try to instantiate a UPath from an s3 path with a # in the URI, the path gets truncated.

I'm running this on Ubuntu 22.04

To reproduce:

from upath import UPath

# this is a public bucket
s3_uri = "s3://aind-open-data/ecephys_661279_2023-03-23_15-31-18/ecephys_compressed/experiment1_Record Node 104#Neuropix-PXI-100.ProbeA.zarr/"

s3path = UPath(s3_uri)
s3path

>>> S3Path('s3://aind-open-data/ecephys_661279_2023-03-23_15-31-18/ecephys_compressed/experiment1_Record Node 104')

Maybe similar to #144 ?

@ap-- ap-- self-assigned this Nov 24, 2023
@ap-- ap-- added the bug 🐛 Something isn't working label Nov 24, 2023
@ap--
Copy link
Collaborator

ap-- commented Nov 24, 2023

Hi @alejoe91

That is indeed a bug related to the urllib based parsing of the fsspec URIs.

As a workaround for now you can provide only the base path of the bucket and join the other parts:

import upath

# for example like this (or using pth.joinpath, or `pth / "otherpath"`)
upath.UPath("s3://aind-open-data/ecephys_661279_2023-03-23_15-31-18/ecephys_compressed", "experiment1_Record Node 104#Neuropix-PXI-100.ProbeA.zarr/", anon=True)

Cheers,
Andreas 😃

@alejoe91
Copy link
Author

Hi @ap--

Thanks for the prompt reply and for the workaround! :)

Looking forward to seeing this fixed in main too!

Cheers,
Alessio

@ap-- ap-- added this to the v0.2.1 milestone Feb 18, 2024
ap-- added a commit to ap--/universal_pathlib that referenced this issue Feb 18, 2024
@ap-- ap-- mentioned this issue Feb 18, 2024
@ap-- ap-- closed this as completed in #191 Feb 18, 2024
ap-- added a commit that referenced this issue Feb 18, 2024
* tests: add s3 test with hash and space characters

Close #164.

* tests: ensure joinpath behavior on s3 consistent with pathlib

Close #167.
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

Successfully merging a pull request may close this issue.

2 participants