1 Commits

Author SHA1 Message Date
dependabot[bot]
99b025b7a3 Bump actions/cache from 4.0.2 to 4.2.0
Bumps [actions/cache](https://github.com/actions/cache) from 4.0.2 to 4.2.0.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](0c45773b62...1bd1e32a3b)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-06 15:25:06 +00:00
2 changed files with 2 additions and 21 deletions

View File

@@ -10,7 +10,7 @@ jobs:
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with: with:
go-version: 1.19 go-version: 1.19
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
with: with:
path: | path: |
~/go/pkg/mod ~/go/pkg/mod

21
ftp.go
View File

@@ -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.