Skip to content

Commit

Permalink
fix(git): support http protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed May 30, 2024
1 parent 4f95ac8 commit 8e74c5e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions db/Repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type RepositoryType string
const (
RepositoryGit RepositoryType = "git"
RepositorySSH RepositoryType = "ssh"
RepositoryHTTPS RepositoryType = "https"
RepositoryHTTP RepositoryType = "https"
RepositoryFile RepositoryType = "file"
RepositoryLocal RepositoryType = "local"
)
Expand Down Expand Up @@ -77,7 +77,7 @@ func (r Repository) GetFullPath(templateID int) string {
func (r Repository) GetGitURL() string {
url := r.GitURL

if r.GetType() == RepositoryHTTPS {
if r.GetType() == RepositoryHTTP {
auth := ""
switch r.SSHKey.Type {
case AccessKeyLoginPassword:
Expand Down Expand Up @@ -114,7 +114,14 @@ func (r Repository) GetType() RepositoryType {
return RepositorySSH
}

return RepositoryType(m[1])
protocol := m[1]

switch protocol {
case "http", "https":
return RepositoryHTTP
default:
return RepositoryType(protocol)
}
}

func (r Repository) Validate() error {
Expand Down

0 comments on commit 8e74c5e

Please sign in to comment.