Browse Source

optimization bee pro gen url

pull/760/head
王厚伟 11 months ago
parent
commit
29e2203ba1
  1. 15
      internal/app/module/beegopro/container.go

15
internal/app/module/beegopro/container.go

@ -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
}

Loading…
Cancel
Save