fix listing
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
parent
f848c36427
commit
f608085a3e
32
main.go
32
main.go
@ -55,6 +55,8 @@ func handle(c net.Conn) {
|
|||||||
cmd := parts[0]
|
cmd := parts[0]
|
||||||
params := strings.Join(parts[1:], "")
|
params := strings.Join(parts[1:], "")
|
||||||
switch cmd {
|
switch cmd {
|
||||||
|
case "RNFR":
|
||||||
|
s.cmdServerRnfr(params)
|
||||||
case "OPTS":
|
case "OPTS":
|
||||||
s.cmdServerOpts(params)
|
s.cmdServerOpts(params)
|
||||||
case "MDTM":
|
case "MDTM":
|
||||||
@ -181,20 +183,21 @@ func (s *Conn) cmdServerList(args string) {
|
|||||||
args = ""
|
args = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(args, "/") {
|
if len(args) > 0 && args[0] == '/' {
|
||||||
cnt = strings.Split(args, "/")[1]
|
cnt = strings.Split(args, "/")[1]
|
||||||
p = strings.Join(strings.Split(args, "/")[2:], "/")
|
p = strings.Join(strings.Split(args, "/")[2:], "/")
|
||||||
} else {
|
} else {
|
||||||
if s.path != "/" {
|
if s.path != "/" {
|
||||||
if strings.HasPrefix(s.path, "/") {
|
|
||||||
cnt = strings.Split(s.path, "/")[1]
|
cnt = strings.Split(s.path, "/")[1]
|
||||||
p = args
|
p = args
|
||||||
}
|
fmt.Printf("cnt1 path %s cnt %s p %s\n", s.path, cnt, p)
|
||||||
} else {
|
} else {
|
||||||
|
fmt.Printf("cnt2 %s\n", s.path)
|
||||||
cnt = strings.Split(args, "/")[0]
|
cnt = strings.Split(args, "/")[0]
|
||||||
|
p = strings.Join(strings.Split(args, "/")[1:], "/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fmt.Printf("cnt3 %s p %s\n", cnt, p)
|
||||||
if cnt == "" {
|
if cnt == "" {
|
||||||
cnts, err := s.sw.ContainersAll(nil)
|
cnts, err := s.sw.ContainersAll(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -207,8 +210,11 @@ func (s *Conn) cmdServerList(args string) {
|
|||||||
files = append(files, it)
|
files = append(files, it)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if p == "" {
|
||||||
|
p = filepath.Clean(strings.Join(strings.Split(s.path, "/")[2:], "/"))
|
||||||
|
}
|
||||||
opts := &swift.ObjectsOpts{Delimiter: '/'}
|
opts := &swift.ObjectsOpts{Delimiter: '/'}
|
||||||
fmt.Printf("cnt: %s p: %s\n", cnt, p)
|
fmt.Printf("cnt4: %s p: %s\n", cnt, p)
|
||||||
if p != "." {
|
if p != "." {
|
||||||
opts.Path = p
|
opts.Path = p
|
||||||
}
|
}
|
||||||
@ -405,7 +411,11 @@ func (s *Conn) cmdServerSize(args string) {
|
|||||||
|
|
||||||
func (s *Conn) cmdServerCwd(args string) {
|
func (s *Conn) cmdServerCwd(args string) {
|
||||||
fmt.Printf("cmdServerCwd: %s\n", args)
|
fmt.Printf("cmdServerCwd: %s\n", args)
|
||||||
s.path = filepath.Clean("/" + args)
|
if args[0] != '/' {
|
||||||
|
s.path = filepath.Clean(filepath.Join(s.path, args))
|
||||||
|
} else {
|
||||||
|
s.path = filepath.Clean(args)
|
||||||
|
}
|
||||||
s.ctrl.PrintfLine(`250 "%s" is current directory.`, s.path)
|
s.ctrl.PrintfLine(`250 "%s" is current directory.`, s.path)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -628,6 +638,16 @@ func (s *Conn) cmdServerSite(args string) {
|
|||||||
//SITE CHMOD 0644 /public/.wgetpaste.conf
|
//SITE CHMOD 0644 /public/.wgetpaste.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Conn) cmdServerRnfr(args string) {
|
||||||
|
// s.Src = args
|
||||||
|
s.ctrl.PrintfLine(`550 Success`)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Conn) cmdServerRnto(args string) {
|
||||||
|
// s.Dst = args
|
||||||
|
s.ctrl.PrintfLine(`550 Success`)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Conn) cmdServerAuth(args string) {
|
func (s *Conn) cmdServerAuth(args string) {
|
||||||
switch args {
|
switch args {
|
||||||
case "TLS":
|
case "TLS":
|
||||||
|
Loading…
Reference in New Issue
Block a user