Skip to content

Fix trailing slash handling in repository URLs#709

Open
Sanjays2402 wants to merge 1 commit into
DagsHub:mainfrom
Sanjays2402:fix/init-trailing-slash
Open

Fix trailing slash handling in repository URLs#709
Sanjays2402 wants to merge 1 commit into
DagsHub:mainfrom
Sanjays2402:fix/init-trailing-slash

Conversation

@Sanjays2402

Copy link
Copy Markdown

Repository URLs copied from a browser can end in /, which made dagshub.init() parse the repository name as empty and the owner as the repository name. Strip trailing separators before extracting the owner/name pair and cover the browser-style URL with a regression test.

Fixes #701

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Failed to post review comments.

GitHub was unavailable or timed out while CodeRabbit was posting the review. Please request a new review later if the pull request still needs one. Use @coderabbitai full review to retry the review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ebeba6da-82b7-48b4-91f4-9dc1045ba150

📥 Commits

Reviewing files that changed from the base of the PR and between 733227f and 00810be.

📒 Files selected for processing (2)
  • dagshub/common/init.py
  • tests/common/test_init.py
📝 Walkthrough

Walkthrough

dagshub.init now removes trailing slashes from repository URLs before parsing them, with a test covering repository initialization from a trailing-slash URL.

Changes

Repository URL normalization

Layer / File(s) Summary
Normalize repository URLs and verify parsing
dagshub/common/init.py, tests/common/test_init.py
init() strips trailing / characters before deriving repository details and service URLs; the test verifies correct repository API and creation arguments.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A bunny found a slash at the door,
And swept it away from the repo floor.
Owner and name now hop in line,
API calls land just fine.
“No empty names!” the rabbit cheers,
While trailing slashes disappear.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: handling trailing slashes in repository URLs.
Description check ✅ Passed The description matches the code change and regression test for browser-copied URLs with trailing slashes.
Linked Issues check ✅ Passed Issue #701's trailing-slash parsing bug is fixed, and the regression test covers the browser-style URL.
Out of Scope Changes check ✅ Passed The changes stay focused on URL normalization and its regression test, with no unrelated edits.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dagshub.init(url=...) with trailing slash sets repo_name="" and repo_owner to the wrong segment

1 participant