Skip to content
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

Check if URL contains basic auth in URL #1523

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions pkg/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,17 @@ func NormalizeRepository(str string) (string, string, string, string, string) {
// resolve branch
branch := ""
if match := branchRegEx.FindStringSubmatch(str); match != nil {
str = match[1]
branch = match[2]
// Check if basic auth is used, if so concat the user info and URL
if strings.Contains(match[1], ":") {
str = match[1] + "@" + match[2]
if innerMatch := branchRegEx.FindStringSubmatch(str); innerMatch != nil {
str = innerMatch[1]
branch = innerMatch[2]
}
} else {
str = match[1]
branch = match[2]
}
bkneis marked this conversation as resolved.
Show resolved Hide resolved
}

// resolve commit hash
Expand Down
Loading