Commit 32c8250f authored by Bruce Flynn's avatar Bruce Flynn
Browse files

fix yet another recursion bug in ReadDir. Trim before decodeing.

parent df74d04d
package main
import (
"strings"
"bufio"
"encoding/binary"
"encoding/json"
......@@ -83,7 +84,7 @@ func (c mySFTPClient) Open(path string) (io.ReadCloser, error) {
}
func (c mySFTPClient) ReadDir(path string) ([]os.FileInfo, error) {
return c.ReadDir(path)
return c.SFTP.ReadDir(path)
}
func (c mySFTPClient) Remove(path string) error {
......@@ -172,7 +173,10 @@ func textCommands(src io.Reader) <-chan command {
go func() {
scanner := bufio.NewScanner(src)
for scanner.Scan() {
line := scanner.Text()
line := strings.TrimSpace(scanner.Text())
if len(line) == 0 {
continue
}
cmd, err := decodeCommand([]byte(line))
if err != nil {
info("ERROR bad command, bailing!!!: %s", err)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment