-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix GitLab clone URL parsing for self-hosted domains #2155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix GitLab clone URL parsing for self-hosted domains #2155
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
User description
Summary
Testing
PR Type
Bug fix, Tests
Description
Refactor GitLab clone URL parsing to support custom domains
urllib.parse.urlparse()for robust URL handlingPreserve legacy parsing as fallback for raw URLs
Add comprehensive unit tests for gitlab.com, custom domains, and invalid URLs
Diagram Walkthrough
flowchart LR A["Clone URL Input"] --> B{"Has http/https scheme?"} B -->|Yes| C["Parse with urlparse"] C --> D["Extract scheme, host, path"] D --> E["Build authenticated URL"] E --> F["Return clone URL"] B -->|No| G{"Contains gitlab.?"} G -->|Yes| H["Legacy gitlab. parsing"] H --> F G -->|No| I["Return error"]File Walkthrough
gitlab_provider.py
Refactor clone URL parsing for custom domainspr_agent/git_providers/gitlab_provider.py
gitlab.domain splitting withurllib.parse.urlparse()for robust URL parsinggitlab.example.com) inaddition to
gitlab.*domainsexistence
test_gitlab_provider.py
Add clone URL parsing teststests/unittest/test_gitlab_provider.py
provider.gl.oauth_token = "fake_token"to fixture for tokenavailability
gitlab.comclone URL with token injectiongitlab.example.com)