Compare commits
No commits in common. "master" and "v0.2.2" have entirely different histories.
16
ftp.go
16
ftp.go
@ -1102,7 +1102,7 @@ func (c *ServerConn) Search(pattern string) ([]string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
msgs := make([]string, 0)
|
msgs := make([]string, 0)
|
||||||
re := regexp.MustCompile(`^[^\/]*(?P<Path>\/.*) \(.*\).*$`)
|
re := regexp.MustCompile(`^200- (?P<Path>.*) \(.*\).*$`)
|
||||||
for _, msg := range strings.Split(message, "\n") {
|
for _, msg := range strings.Split(message, "\n") {
|
||||||
if re.MatchString(msg) {
|
if re.MatchString(msg) {
|
||||||
msgs = append(msgs, re.ReplaceAllString(msg, "${Path}"))
|
msgs = append(msgs, re.ReplaceAllString(msg, "${Path}"))
|
||||||
@ -1112,20 +1112,6 @@ func (c *ServerConn) Search(pattern string) ([]string, error) {
|
|||||||
return msgs, nil
|
return msgs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search returns all the directories matching the search pattern
|
|
||||||
func (c *ServerConn) Searches(patterns []string) ([]string, error) {
|
|
||||||
msgs := make([]string, 0)
|
|
||||||
for _, pattern := range patterns {
|
|
||||||
msg, err := c.Search(pattern)
|
|
||||||
if err != nil {
|
|
||||||
return msgs, err
|
|
||||||
}
|
|
||||||
msgs = append(msgs, msg...)
|
|
||||||
}
|
|
||||||
|
|
||||||
return msgs, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// NoOp issues a NOOP FTP command.
|
// NoOp issues a NOOP FTP command.
|
||||||
// NOOP has no effects and is usually used to prevent the remote FTP server to
|
// NOOP has no effects and is usually used to prevent the remote FTP server to
|
||||||
// close the otherwise idle connection.
|
// close the otherwise idle connection.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user