Skip to content

Commit cffeca1

Browse files
committed
Keep bare HTTP origins on the service discovery path
1 parent 04a69b2 commit cffeca1

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎src/blosc2/b2view/ordinary_file.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ def ordinary_source(urlpath, remote_service="auto"):
3737
return False
3838
member = _source_member(str(base))
3939
parsed = urlsplit(member)
40-
suffix = PurePosixPath(parsed.path or parsed.netloc).suffix.lower()
40+
# HTTP authorities are hosts, not filenames (e.g. service.example.com).
41+
# Archive/member protocols may instead carry the filename in the authority.
42+
name = parsed.path if parsed.scheme in {"http", "https"} else parsed.path or parsed.netloc
43+
suffix = PurePosixPath(name).suffix.lower()
4144
if suffix in NATIVE_SUFFIXES:
4245
return False
4346
if is_fsspec_url(urlpath):

‎tests/b2view/test_ordinary_files.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,16 @@ def test_dataset_and_service_routing_unchanged(source):
256256
assert not ordinary_source(source)
257257

258258

259+
@pytest.mark.parametrize(
260+
"source",
261+
["https://service.example.com", "https://service.example.com/", "http://service.example.com:8080"],
262+
)
263+
def test_bare_http_origins_keep_service_discovery(source):
264+
assert not ordinary_source(source)
265+
assert ordinary_source(source, remote_service="fsspec")
266+
assert ordinary_source(source + "/README.md")
267+
268+
259269
def test_ipv6_http_and_explicit_fsspec_routing():
260270
assert ordinary_source("http://[::1]/README.md")
261271
assert ordinary_source("http://[::1]/no-extension", "fsspec")

0 commit comments

Comments
 (0)