Compare commits
1 Commits
v0.2.1
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e64702b451 |
2
.github/workflows/golangci-lint.yaml
vendored
2
.github/workflows/golangci-lint.yaml
vendored
@@ -11,6 +11,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.1.7
|
- uses: actions/checkout@v4.1.7
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86
|
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8
|
||||||
with:
|
with:
|
||||||
only-new-issues: true
|
only-new-issues: true
|
||||||
|
|||||||
21
ftp.go
21
ftp.go
@@ -11,7 +11,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/textproto"
|
"net/textproto"
|
||||||
"regexp"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -828,7 +827,7 @@ func (c *ServerConn) CurrentDir() (string, error) {
|
|||||||
end := strings.LastIndex(msg, "\"")
|
end := strings.LastIndex(msg, "\"")
|
||||||
|
|
||||||
if start == -1 || end == -1 {
|
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
|
return msg[start+1 : end], nil
|
||||||
@@ -1094,24 +1093,6 @@ func (c *ServerConn) Walk(root string) *Walker {
|
|||||||
return w
|
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 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.
|
||||||
|
|||||||
Reference in New Issue
Block a user