kubero-dev / kubero-dev/kubero

Malformed clone_url generated when repo URL is in ssh:// format (regex isn't anchored)

Open Beginner friendly
#797 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
4.4k
Forks
213
PR merge metrics
No merged PRs in 30d

Description

### Which component(s) is affected?

Kubero CLI

### Describe the bug

In client/src/components/apps/form.vue (updateApp(), around line 2307-2312), clone_url is derived from ssh_url using this regex:

js
const regex = /(git@|ssh:|http[s]?:\/\/)([\w.]+)(:|\/)([\w/\-~]+)(\.git)?/;
this.gitrepo.clone_url = this.gitrepo.ssh_url.replace(regex, "https://$2/$4$5");

This works for the scp-style git@host:path format, but not for ssh://user@host/path format. Since the regex isn't anchored to the start of the string, when matching against ssh://git@github.com/foo/bar.git, the ssh: alternative fails to match at position 0 (the next character is /, not a word character), so the engine slides forward and matches starting at git@ instead. .replace() only swaps out the matched substring, leaving the ssh:// prefix untouched.

### Steps to reproduce

1. Edit an app's git repository field in the Kubero UI with a URL in ssh://user@host/path.git format
2. Save
3. Inspect the resulting clone_url on the KuberoApp CR

### Expected behavior

Expected behavior: clone_url should be a valid https://host/path.git URL.

Actual behavior: clone_url becomes ssh://https://host/path.git — malformed and unusable for cloning.

Suggested fix: Anchor the regex (^) or use a proper URL-parsing approach instead of a permissive unanchored match.

### Screenshots

_No response_

### Additional information

_No response_

### Debug information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in client/src/components/apps/form.vue, in updateApp() around lines 2307-2312, and inspect how ssh_url is transformed into clone_url. Reproduce with an ssh://user@host/path.git repository, save the app, and inspect the resulting clone_url on the KuberoApp CR. Done means the value is a valid https://host/path.git URL without the ssh:// prefix.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.