Skip to content

Commit 940c362

Browse files
aaschaerkurtmckee
andauthored
allow passing /v2/ paths to globus api transfer (#1249)
Co-authored-by: Kurt McKee <contactme@kurtmckee.org>
1 parent e0c4f1c commit 940c362

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Bugfixes
2+
3+
* `globus api transfer` no longer prepends `/v0.10/` to `/v2/` paths

src/globus_cli/commands/api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ def _execute_service_command(
324324
if path.startswith("/"):
325325
path = path[1:]
326326
path = f"/v2/{path}"
327-
if isinstance(client, globus_sdk.TransferClient) and not path.startswith("/v0.10/"):
327+
if isinstance(client, globus_sdk.TransferClient) and not (
328+
path.startswith(("/v0.10/", "/v2/"))
329+
):
328330
if path.startswith("/"):
329331
path = path[1:]
330332
path = f"/v0.10/{path}"

tests/functional/test_api.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@ def test_api_command_get(run_line, service_name, add_gcs_login, is_error_respons
7777
assert result.output == '{"foo": "bar"}\n'
7878

7979

80+
def test_api_transfer_v2_command(run_line):
81+
load_response(
82+
RegisteredResponse(
83+
service="transfer",
84+
status=200,
85+
path="/v2/foo",
86+
json={"foo": "bar"},
87+
)
88+
)
89+
90+
result = run_line(["globus", "api", "transfer", "get", "/v2/foo"])
91+
assert result.output == '{"foo": "bar"}\n'
92+
93+
8094
def test_api_groups_v2_path_stripping(run_line):
8195
load_response(
8296
RegisteredResponse(

0 commit comments

Comments
 (0)