1
0
forked from x/ContextOS

fix web.merge bug

This commit is contained in:
shylinux 2019-01-02 11:58:54 +08:00
parent 8cd8222b3f
commit e92c25d5e6
2 changed files with 19 additions and 14 deletions

View File

@ -526,7 +526,8 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
switch arg[1] { switch arg[1] {
case "create": case "create":
bid, arg = m.Cmdx("aaa.auth", arg[0], "ship", "bench", arg[2]), arg[3:] bid, arg = m.Cmdx("aaa.auth", arg[0], "ship", "bench", arg[2]), arg[3:]
m.Cmdx("aaa.auth", bid, "data", "name", "web") m.Cmd("aaa.auth", bid, "data", "name", "web")
defer func() { m.Set("result").Echo(bid) }()
case "select": case "select":
m.Cmd("aaa.auth", arg[0], "ship", "bench").Table(func(maps map[string]string, list []string, line int) bool { m.Cmd("aaa.auth", arg[0], "ship", "bench").Table(func(maps map[string]string, list []string, line int) bool {
if strings.Contains(maps["meta"], arg[2]) || strings.HasPrefix(maps["key"], arg[2]) || strings.HasSuffix(maps["key"], arg[2]) { if strings.Contains(maps["meta"], arg[2]) || strings.HasPrefix(maps["key"], arg[2]) || strings.HasSuffix(maps["key"], arg[2]) {
@ -540,6 +541,8 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
} }
case "bench": case "bench":
bid, arg = arg[0], arg[1:] bid, arg = arg[0], arg[1:]
default:
return
} }
if len(arg) == 0 { if len(arg) == 0 {

View File

@ -48,19 +48,21 @@ func merge(m *ctx.Message, uri string, arg ...string) string {
add, e := url.Parse(uri) add, e := url.Parse(uri)
m.Assert(e) m.Assert(e)
if add.Scheme == "" { if false {
add.Scheme = m.Conf("protocol") if add.Scheme == "" {
} add.Scheme = m.Conf("protocol")
if add.Host == "" { }
add.Host = m.Conf("hostname") if add.Host == "" {
} add.Host = m.Conf("hostname")
if add.Path == "" { }
add.Path = path.Join(m.Conf("path"), m.Conf("file")) if add.Path == "" {
} else if !path.IsAbs(add.Path) { add.Path = path.Join(m.Conf("path"), m.Conf("file"))
add.Path = path.Join(m.Conf("path"), add.Path) } else if !path.IsAbs(add.Path) {
} add.Path = path.Join(m.Conf("path"), add.Path)
if add.RawQuery == "" { }
add.RawQuery = m.Conf("query") if add.RawQuery == "" {
add.RawQuery = m.Conf("query")
}
} }
query := add.Query() query := add.Query()