From b0a2ce04cf28d36367510ac74dbd2445c93b63be Mon Sep 17 00:00:00 2001 From: Libba Lawrence Date: Thu, 5 Feb 2026 13:07:52 -0800 Subject: [PATCH 1/3] stub url --- sdk/core/azure-core/azure/core/pipeline/transport/_base.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/_base.py b/sdk/core/azure-core/azure/core/pipeline/transport/_base.py index a853bafda8e4..ec7d5bc5fa85 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/_base.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_base.py @@ -130,9 +130,10 @@ def _urljoin(base_url: str, stub_url: str) -> str: # Note that _replace is a public API named that way to avoid conflicts in namedtuple # https://docs.python.org/3/library/collections.html?highlight=namedtuple#collections.namedtuple - parsed_base_url = parsed_base_url._replace( - path=parsed_base_url.path.rstrip("/") + "/" + stub_url_path, - ) + if stub_url_path: + parsed_base_url = parsed_base_url._replace( + path=parsed_base_url.path.rstrip("/") + "/" + stub_url_path, + ) if stub_url_query: query_params = [stub_url_query] if parsed_base_url.query: From 6909a40bd4ae9eddcefd134efff9129278e24e13 Mon Sep 17 00:00:00 2001 From: Libba Lawrence Date: Thu, 5 Feb 2026 14:30:57 -0800 Subject: [PATCH 2/3] test --- sdk/core/azure-core/tests/test_basic_transport.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/core/azure-core/tests/test_basic_transport.py b/sdk/core/azure-core/tests/test_basic_transport.py index 24d3790f0590..2f8cfd70c8c1 100644 --- a/sdk/core/azure-core/tests/test_basic_transport.py +++ b/sdk/core/azure-core/tests/test_basic_transport.py @@ -128,7 +128,8 @@ def test_http_request_serialization(http_request): @pytest.mark.parametrize("http_request", HTTP_REQUESTS) def test_url_join(http_request): - assert _urljoin("devstoreaccount1", "") == "devstoreaccount1/" + assert _urljoin("devstoreaccount1", "?testdir") == "devstoreaccount1?testdir" + assert _urljoin("devstoreaccount1", "") == "devstoreaccount1" assert _urljoin("devstoreaccount1", "testdir/") == "devstoreaccount1/testdir/" assert _urljoin("devstoreaccount1/", "") == "devstoreaccount1/" assert _urljoin("devstoreaccount1/", "testdir/") == "devstoreaccount1/testdir/" From abec6a7f540a053e64dd75318c1c8b9dfe98aecc Mon Sep 17 00:00:00 2001 From: Libba Lawrence Date: Mon, 9 Feb 2026 08:52:34 -0800 Subject: [PATCH 3/3] changelog --- sdk/core/azure-core/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index c45caf490aa6..6ee9aee17722 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -8,6 +8,8 @@ ### Bugs Fixed +- Fixed PipelineClient.format_url to avoid adding trailing slashes when the URL template contains only query parameters. + ### Other Changes ## 1.38.0 (2026-01-12)