Skip to content

πŸ™Œ OpenHands: AI-Driven Development

bugfix: selected_repository may includes more then two parts, could b… (#7114)

answer-huangd6e601ea2e2a
diff --git a/openhands/runtime/base.py b/openhands/runtime/base.py
index 6a2ce91a8f..291c8f3063 100644
--- a/openhands/runtime/base.py
+++ b/openhands/runtime/base.py
@@ -274,7 +274,7 @@ class Runtime(FileEditRuntimeMixin):
'github_token and selected_repository must be provided to clone a repository'
)
url = f'https://{github_token.get_secret_value()}@github.com/{selected_repository}.git'
- dir_name = selected_repository.split('/')[1]
+ dir_name = selected_repository.split('/')[-1]
# Generate a random branch name to avoid conflicts
random_str = ''.join(
@@ -313,7 +313,7 @@ class Runtime(FileEditRuntimeMixin):
microagents_dir = workspace_root / '.openhands' / 'microagents'
repo_root = None
if selected_repository:
- repo_root = workspace_root / selected_repository.split('/')[1]
+ repo_root = workspace_root / selected_repository.split('/')[-1]
microagents_dir = repo_root / '.openhands' / 'microagents'
self.log(
'info',