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

Keys not URL-decoded when loaded over the network #2076

Open
aeisenbarth opened this issue Aug 10, 2024 · 0 comments
Open

Keys not URL-decoded when loaded over the network #2076

aeisenbarth opened this issue Aug 10, 2024 · 0 comments
Labels
bug Potential issues with the zarr-python library V2 Affects the v2 branch

Comments

@aeisenbarth
Copy link

Zarr version

v2.17.1

Numcodecs version

v0.12.1

Python Version

3.10

Operating System

Linux

Installation

Using pip into a conda environment

Description

When files are served over the network, the server must encode certain characters using percent-encoding (RFC3986 2.2).
When Zarr opens a dataset from a URL, keys are incorrectly set from percent-encoded file names.

Steps to reproduce

Create a dataset containing any of (: /) ? # [ ] @ ! $ & ' ( ) * + , ; =.
Here, the array key contains +.

import numpy as np
import zarr

g = zarr.open_group("dataset.zarr")
g.create_dataset(name="a+b", data=np.eye(3))

Serve the dataset with a local server. Go into the directory where you saved the data and run:

python -m http.server

In a web browser you can confirm that the URLs are correctly percent-encoded, but the file listing is decoded:

Try reading the dataset from a URL:

>>> g = zarr.open("http://0.0.0.0:8000/dataset.zarr/")
>>> list(g.keys())
['a%2Bb']

Additional output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Potential issues with the zarr-python library V2 Affects the v2 branch
Projects
None yet
Development

No branches or pull requests

2 participants