File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ def _kernel_host_and_path(
7575 # unconditionally would otherwise yield a malformed double-``?``
7676 # path (e.g. ``/warehouses/abc?o=111?o=222``) that mis-parses
7777 # downstream and silently drops the org-id header.
78- path = "{}?{}" .format (path .split ("?" , 1 )[0 ], parts .query )
78+ path = "{}?{}" .format (( path or "" ) .split ("?" , 1 )[0 ], parts .query )
7979 return host , path
8080
8181 port = kwargs .get ("_port" )
Original file line number Diff line number Diff line change @@ -792,6 +792,16 @@ def test_connection_uri_without_path_query_replaces_original_path_query(self):
792792 assert host == "https://h.example.com:8443"
793793 assert path == "/sql/1.0/warehouses/abc?o=222"
794794
795+ def test_connection_uri_without_path_and_none_http_path_applies_query (self ):
796+ # http_path is legitimately nullable on the connect path. A path-less,
797+ # query-bearing URI combined with http_path=None must not raise; the
798+ # retained path coerces to empty before the query is applied.
799+ host , path = _kernel_host_and_path (
800+ self .HOST , None , {"_connection_uri" : "https://h.example.com:8443?o=222" }
801+ )
802+ assert host == "https://h.example.com:8443"
803+ assert path == "?o=222"
804+
795805 def test_connection_uri_wins_over_port (self ):
796806 host , path = _kernel_host_and_path (
797807 self .HOST ,
You can’t perform that action at this time.
0 commit comments