-
Notifications
You must be signed in to change notification settings - Fork 671
OCPBUGS-74387: "Import from Git" forces HTTPS, port 443 #15975
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
Open
QuadJust
wants to merge
1
commit into
openshift:main
Choose a base branch
from
QuadJust:OCPBUGS-74387
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: openshift/console
Length of output: 43
🏁 Script executed:
Repository: openshift/console
Length of output: 1464
🏁 Script executed:
# Check git-service package.json for git-url-parse dependency cat ./frontend/packages/git-service/package.jsonRepository: openshift/console
Length of output: 883
🏁 Script executed:
Repository: openshift/console
Length of output: 930
🏁 Script executed:
Repository: openshift/console
Length of output: 1196
🏁 Script executed:
Repository: openshift/console
Length of output: 147
🏁 Script executed:
Repository: openshift/console
Length of output: 4337
🏁 Script executed:
Repository: openshift/console
Length of output: 1050
🏁 Script executed:
Repository: openshift/console
Length of output: 780
🏁 Script executed:
# Check the gitea-service tests to understand expected behavior cat frontend/packages/git-service/src/services/__tests__/gitea-service.spec.tsRepository: openshift/console
Length of output: 9406
🏁 Script executed:
Repository: openshift/console
Length of output: 2445
🏁 Script executed:
Repository: openshift/console
Length of output: 2005
🌐 Web query:
git-url-parse protocols array empty SSH shorthand URL behavior💡 Result:
In
git-url-parse, theprotocolsarray represents only the protocol tokens that are explicitly present in the input string (the parts before://, and split by+for things likegit+ssh). So:git+ssh://git@host.xz/path/name.git→protocols: ["git","ssh"](explicit) andprotocol: "git"(the “first” protocol) [1][2]git@github.com:owner/repo.githave no scheme section at all (nossh://), soprotocolsis empty ([]) even though the library still infers the effective transport as SSH and setsprotocol: "ssh"[1][3].This matches Git’s own “scp-like” SSH syntax (
[user@]host:path/to/repo.git), which is SSH despite not being a formal URI with a scheme. [3][4]Sources: [1]
git-url-parseexample output, [2]parse-url/git protocol tokenization examples, [3] Git “scp-like” SSH syntax description, [4] explanation of scp-like parsing behavior.🏁 Script executed:
Repository: openshift/console
Length of output: 43
🏁 Script executed:
Repository: openshift/console
Length of output: 524
🏁 Script executed:
Repository: openshift/console
Length of output: 43
Add defensive fallback for empty
protocolsarray.The
git-url-parselibrary returns an emptyprotocolsarray for SSH shorthand URLs (e.g.,git@gitea.example.com:owner/repo.git). Accessingprotocols[0]without a guard producesundefined, resulting in malformed host strings likeundefined://resource.Add a fallback to a sensible default:
Proposed fix
const { name, owner, protocols, port, resource, full_name: fullName } = GitUrlParse( this.gitsource.url, ); const contextDir = this.gitsource.contextDir?.replace(/\/$/, '') || ''; + const protocol = protocols?.[0] || 'https'; - const host = _.isEmpty(port) - ? `${protocols[0]}://${resource}` - : `${protocols[0]}://${resource}:${port}`; + const host = _.isEmpty(port) + ? `${protocol}://${resource}` + : `${protocol}://${resource}:${port}`;📝 Committable suggestion
🤖 Prompt for AI Agents