Problem
dagshub.init(url="https://dagshub.com/<owner>/<repo>/") (trailing slash, as copy-pasted from a browser address bar) silently produces repo_owner="<repo>" and repo_name="", then calls RepoAPI("<repo>/") and create_repo("", ...) on the not-found branch.
Cite
dagshub/common/init.py lines 76-79:
if url.endswith(".git"):
url = url[:-4]
parts = url.split("/")
repo_owner, repo_name = parts[-2], parts[-1]
No strip of trailing /, no length/emptiness check.
Steps
url = "https://dagshub.com/owner/repo/"
if url.endswith(".git"): url = url[:-4]
parts = url.split("/")
repo_owner, repo_name = parts[-2], parts[-1]
print(repr(repo_owner), repr(repo_name))
Expected
'owner' 'repo'
Actual
'repo' ''
Environment
- dagshub
0.7.0 (dagshub/__init__.py)
- Python
>=3.9 (setup.py)
- OS-independent
Fix: strip trailing / before split, and raise if not repo_owner or not repo_name.
Thanks for maintaining DagsHub/client!
Problem
dagshub.init(url="https://dagshub.com/<owner>/<repo>/")(trailing slash, as copy-pasted from a browser address bar) silently producesrepo_owner="<repo>"andrepo_name="", then callsRepoAPI("<repo>/")andcreate_repo("", ...)on the not-found branch.Cite
dagshub/common/init.pylines 76-79:No strip of trailing
/, no length/emptiness check.Steps
Expected
'owner' 'repo'Actual
'repo' ''Environment
0.7.0(dagshub/__init__.py)>=3.9(setup.py)Fix: strip trailing
/before split, and raise ifnot repo_owner or not repo_name.Thanks for maintaining DagsHub/client!