Compare commits
1 Commits
v0.2.1
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee8590100a |
2
.github/workflows/unit_tests.yaml
vendored
2
.github/workflows/unit_tests.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
- name: Run tests
|
||||
run: go test -v -covermode=count -coverprofile=coverage.out
|
||||
- name: Convert coverage to lcov
|
||||
uses: jandelgado/gcov2lcov-action@c680c0f7c7442485f1749eb2a13e54a686e76eb5
|
||||
uses: jandelgado/gcov2lcov-action@4e1989767862652e6ca8d3e2e61aabe6d43be28b
|
||||
- name: Coveralls
|
||||
uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63
|
||||
with:
|
||||
|
||||
21
ftp.go
21
ftp.go
@@ -11,7 +11,6 @@ import (
|
||||
"io"
|
||||
"net"
|
||||
"net/textproto"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -828,7 +827,7 @@ func (c *ServerConn) CurrentDir() (string, error) {
|
||||
end := strings.LastIndex(msg, "\"")
|
||||
|
||||
if start == -1 || end == -1 {
|
||||
return "", errors.New("unsupported PWD response format")
|
||||
return "", errors.New("unsuported PWD response format")
|
||||
}
|
||||
|
||||
return msg[start+1 : end], nil
|
||||
@@ -1094,24 +1093,6 @@ func (c *ServerConn) Walk(root string) *Walker {
|
||||
return w
|
||||
}
|
||||
|
||||
// Search returns all the directories matching the search pattern
|
||||
func (c *ServerConn) Search(pattern string) ([]string, error) {
|
||||
_, message, err := c.cmd(StatusCommandOK, "SITE SEARCH %s", pattern)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
msgs := make([]string, 0)
|
||||
re := regexp.MustCompile(`^200- (?P<Path>.*) \(.*\).*$`)
|
||||
for _, msg := range strings.Split(message, "\n") {
|
||||
if re.MatchString(msg) {
|
||||
msgs = append(msgs, re.ReplaceAllString(msg, "${Path}"))
|
||||
}
|
||||
}
|
||||
|
||||
return msgs, nil
|
||||
}
|
||||
|
||||
// NoOp issues a NOOP FTP command.
|
||||
// NOOP has no effects and is usually used to prevent the remote FTP server to
|
||||
// close the otherwise idle connection.
|
||||
|
||||
Reference in New Issue
Block a user