@@ -37,7 +37,8 @@ def _kernel_host_and_path(
3737 (returned as ``host``) and its path+query (returned as ``http_path``).
3838 ``_connection_uri`` wins over ``_port``, matching the Thrift backend.
3939 When the URI omits a path (e.g. ``https://host:8443`` or
40- ``https://host:8443?o=222``) the connection's original ``http_path`` is
40+ ``https://host:8443?o=222``, and likewise a lone trailing slash such as
41+ ``https://host:8443/``) the connection's original ``http_path`` is
4142 retained, and any query on the URI is applied to that retained path,
4243 replacing any query the retained path already carried — so a path-less,
4344 query-bearing URI overrides only the host and query while keeping the
@@ -67,8 +68,12 @@ def _kernel_host_and_path(
6768 host = "{}://{}" .format (parts .scheme , parts .netloc )
6869 # A path-less URI keeps the connection's original http_path; any query
6970 # on the URI is then applied to that retained path (host + query
70- # override, path preserved). See the docstring for the rationale.
71- path = parts .path or http_path
71+ # override, path preserved). A lone ``"/"`` path (common from a
72+ # copy-pasted base URL like ``https://host:8443/``) is treated the same
73+ # as an absent path so it does not silently point the kernel at the host
74+ # root instead of the warehouse. See the docstring for the rationale.
75+ uri_path = parts .path if parts .path not in ("" , "/" ) else None
76+ path = uri_path or http_path
7277 if parts .query :
7378 # Drop any query already on the retained path before applying the
7479 # URI's query, so the URI's query fully overrides it. Appending
0 commit comments