1
0
mirror of https://github.com/beego/bee.git synced 2024-11-23 22:10:54 +00:00

optimization bee pro gen url

This commit is contained in:
王厚伟 2021-01-11 00:24:24 +08:00
parent a44ef93f99
commit 29e2203ba1

View File

@ -3,6 +3,7 @@ package beegopro
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/url"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -242,10 +243,12 @@ func (c *Container) GetLocalPath() {
if c.UserOption.GitRemotePath == "" { if c.UserOption.GitRemotePath == "" {
c.UserOption.GitRemotePath = "https://github.com/beego/beego-pro.git" c.UserOption.GitRemotePath = "https://github.com/beego/beego-pro.git"
} }
url := c.UserOption.GitRemotePath parse, err := url.Parse(c.UserOption.GitRemotePath)
url = strings.TrimPrefix(url, "http://") if err != nil {
url = strings.TrimPrefix(url, "https://") beeLogger.Log.Fatalf("git GitRemotePath err, %s", err.Error())
url = strings.TrimRight(url, ".git") return
index := strings.Index(url, "/") }
c.UserOption.GitLocalPath = system.BeegoHome + url[index:] s := parse.Path
s = strings.TrimRight(s, ".git")
c.UserOption.GitLocalPath = system.BeegoHome + s
} }