1
0
mirror of https://github.com/beego/bee.git synced 2024-10-03 11:51:51 +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 (
"fmt"
"io/ioutil"
"net/url"
"strings"
"sync"
"time"
@ -242,10 +243,12 @@ func (c *Container) GetLocalPath() {
if c.UserOption.GitRemotePath == "" {
c.UserOption.GitRemotePath = "https://github.com/beego/beego-pro.git"
}
url := c.UserOption.GitRemotePath
url = strings.TrimPrefix(url, "http://")
url = strings.TrimPrefix(url, "https://")
url = strings.TrimRight(url, ".git")
index := strings.Index(url, "/")
c.UserOption.GitLocalPath = system.BeegoHome + url[index:]
parse, err := url.Parse(c.UserOption.GitRemotePath)
if err != nil {
beeLogger.Log.Fatalf("git GitRemotePath err, %s", err.Error())
return
}
s := parse.Path
s = strings.TrimRight(s, ".git")
c.UserOption.GitLocalPath = system.BeegoHome + s
}