Skip to content

Fix HTTPS parser to consistently reject URLs with extra path segments#453

Closed
cursor[bot] wants to merge 2 commits intomainfrom
cursor/https-parser-path-segments-4cec
Closed

Fix HTTPS parser to consistently reject URLs with extra path segments#453
cursor[bot] wants to merge 2 commits intomainfrom
cursor/https-parser-path-segments-4cec

Conversation

@cursor
Copy link

@cursor cursor bot commented Mar 16, 2026

Summary

Fixed inconsistent behavior between SSH and HTTPS URL parsing in parseGitHubRepo. The HTTPS parser now correctly rejects URLs with more than two path segments, matching the SSH parser's behavior.

Changes

  • Added strings.TrimRight(path, "/") before splitting the path in the HTTPS branch
  • Changed the validation from len(parts) < 2 to len(parts) != 2 for consistency with SSH branch

Bug Details

Previously, the HTTPS parser would accept URLs like https://gitlab.com/group/subgroup/project.git and return "group/subgroup" instead of rejecting them. This could cause secrets/variables to be scoped to incorrect repositories.

The SSH parser correctly rejected such URLs (e.g., git@github.com:a/b/c.git""), but the HTTPS parser was lenient due to using < 2 instead of != 2.

Testing

All existing tests pass, including:

  • TestParseGitHubRepo/too_many_segments - verifies rejection of URLs with 3+ segments
  • TestParseGitHubRepo/https_trailing_slash - verifies trailing slashes still work correctly
Open in Web Open in Cursor 

121watts and others added 2 commits March 16, 2026 14:40
Secrets and variables created during `depot ci migrate` now default to
repo-scoped instead of org-scoped. The repo is auto-detected from the
git remote origin URL, or can be explicitly set via `--repo owner/name`.
Falls back to org scope when the repo cannot be detected.

Made-with: Cursor
The HTTPS branch now trims trailing slashes before splitting and uses
the strict len(parts) != 2 check, matching the SSH branch behavior.
This prevents URLs like https://gitlab.com/group/subgroup/project.git
from silently returning incorrect owner/repo values.
@121watts 121watts force-pushed the watts/dep-3838-depo-ci-migrate-secrets-and-variables-should-default-to-repo branch from 5c3eadc to 0552c5d Compare March 16, 2026 20:18
Base automatically changed from watts/dep-3838-depo-ci-migrate-secrets-and-variables-should-default-to-repo to main March 16, 2026 22:23
@cursor cursor bot closed this Mar 17, 2026
@cursor
Copy link
Author

cursor bot commented Mar 17, 2026

Automatically closed this PR because it was created by Bugbot autofix for #452, and that PR was closed.

@cursor cursor bot deleted the cursor/https-parser-path-segments-4cec branch March 17, 2026 21:25
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.

2 participants