From 8e74c5e127d555f1b786b9444db860a95ef9e4aa Mon Sep 17 00:00:00 2001 From: fiftin Date: Thu, 30 May 2024 13:50:06 +0200 Subject: [PATCH] fix(git): support http protocol --- db/Repository.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/db/Repository.go b/db/Repository.go index e79f9da32..ea89d5cea 100644 --- a/db/Repository.go +++ b/db/Repository.go @@ -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" ) @@ -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: @@ -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 {