From 3a138c5566a340ddc1a1425d3ae0c369845c920f Mon Sep 17 00:00:00 2001 From: onatozmenn Date: Tue, 18 Aug 2026 12:00:56 +0300 Subject: [PATCH] fix(extensions): avoid duplicate git suffix Signed-off-by: onatozmenn --- openhands-sdk/openhands/sdk/extensions/fetch.py | 2 +- tests/sdk/extensions/test_fetch.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/openhands-sdk/openhands/sdk/extensions/fetch.py b/openhands-sdk/openhands/sdk/extensions/fetch.py index 78c2e01713..59038c93af 100644 --- a/openhands-sdk/openhands/sdk/extensions/fetch.py +++ b/openhands-sdk/openhands/sdk/extensions/fetch.py @@ -66,7 +66,7 @@ def parse_extension_source(source: str) -> tuple[SourceType, str]: f"Invalid GitHub shorthand format: {source}. " f"Expected format: github:owner/repo" ) - url = f"https://github.com/{repo_path}.git" + url = normalize_git_url(f"https://github.com/{repo_path}") return (SourceType.GITHUB, url) # Git URLs: detect by protocol/scheme rather than enumerating providers diff --git a/tests/sdk/extensions/test_fetch.py b/tests/sdk/extensions/test_fetch.py index dcf2b41994..1065151e62 100644 --- a/tests/sdk/extensions/test_fetch.py +++ b/tests/sdk/extensions/test_fetch.py @@ -26,6 +26,12 @@ def test_parse_github_shorthand(): assert url == "https://github.com/owner/repo.git" +def test_parse_github_shorthand_with_git_suffix(): + source_type, url = parse_extension_source("github:owner/repo.git") + assert source_type == SourceType.GITHUB + assert url == "https://github.com/owner/repo.git" + + def test_parse_github_shorthand_with_whitespace(): source_type, url = parse_extension_source(" github:owner/repo ") assert source_type == SourceType.GITHUB