Skip to content

Commit f3149d6

Browse files
committed
Always strip preceding / from path in ManifestStore (#764)
* Always strip preceding / from path in ManifestStore * Fix docs error
1 parent be9e1df commit f3149d6

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

docs/usage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ repo = icechunk.Repository.open_or_create(storage)
403403
# you need to explicitly grant permissions to icechunk to read from the locations of your archival files
404404
config = icechunk.RepositoryConfig.default()
405405
config.set_virtual_chunk_container(
406-
icechunk.VirtualChunkContainer("s3://my-bucket", icechunk.s3_store(region="us-east-1", anonymous=True)),
406+
icechunk.VirtualChunkContainer("s3://my-bucket/", icechunk.s3_store(region="us-east-1", anonymous=True)),
407407
)
408408

409409
# open a writable icechunk session to be able to add new contents to the store

virtualizarr/manifests/store.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,11 @@ async def get(
195195
path_in_store = urlparse(path).path
196196
if hasattr(store, "prefix") and store.prefix:
197197
prefix = str(store.prefix).lstrip("/")
198-
path_in_store = path_in_store.lstrip("/").removeprefix(prefix).lstrip("/")
199198
elif hasattr(store, "url"):
200199
prefix = urlparse(store.url).path.lstrip("/")
201-
path_in_store = path_in_store.lstrip("/").removeprefix(prefix).lstrip("/")
200+
else:
201+
prefix = ""
202+
path_in_store = path_in_store.lstrip("/").removeprefix(prefix).lstrip("/")
202203
# Transform the input byte range to account for the chunk location in the file
203204
chunk_end_exclusive = offset + length
204205
byte_range = _transform_byte_range(

0 commit comments

Comments
 (0)