Compare commits

...

27 Commits

Author SHA1 Message Date
shoopea
cf05dac581 add searches
Some checks failed
golangci-lint / lint (push) Has been cancelled
Units tests / test (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
2024-12-27 23:13:26 +01:00
shoopea
b83b870ac3 debug
Some checks failed
CodeQL / Analyze (go) (push) Waiting to run
golangci-lint / lint (push) Has been cancelled
Units tests / test (push) Has been cancelled
2024-12-27 23:07:11 +01:00
shoopea
edc371677f fix mod reference
Some checks failed
CodeQL / Analyze (go) (push) Waiting to run
golangci-lint / lint (push) Has been cancelled
Units tests / test (push) Has been cancelled
2024-12-27 22:58:57 +01:00
shoopea
0d44b53277 add search
Some checks failed
CodeQL / Analyze (go) (push) Waiting to run
golangci-lint / lint (push) Has been cancelled
Units tests / test (push) Has been cancelled
2024-12-27 22:48:28 +01:00
dependabot[bot]
1b970516f5
Bump actions/checkout from 4.1.6 to 4.1.7 (#385)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.6 to 4.1.7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.6...v4.1.7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-18 19:33:26 -04:00
dependabot[bot]
d0a6cb31a2
Bump golangci/golangci-lint-action from 6.0.1 to 6.1.0 (#389)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.0.1 to 6.1.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](a4f60bb28d...aaa42aa062)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-18 19:33:13 -04:00
dependabot[bot]
1c1a6e4887
Bump actions/setup-go from 5.0.1 to 5.0.2 (#388)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.0.1 to 5.0.2.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](cdcb360436...0a12ed9d6a)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-18 19:33:00 -04:00
dependabot[bot]
ebfb9b5098
Bump actions/setup-go from 5.0.0 to 5.0.1 (#375)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](0c52d547c9...cdcb360436)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-27 17:45:10 -04:00
dependabot[bot]
7844f623b3
Bump coverallsapp/github-action from 2.2.3 to 2.3.0 (#380)
Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 2.2.3 to 2.3.0.
- [Release notes](https://github.com/coverallsapp/github-action/releases)
- [Commits](3dfc556739...643bc377ff)

---
updated-dependencies:
- dependency-name: coverallsapp/github-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-27 17:45:01 -04:00
dependabot[bot]
2304047ac3
Bump golangci/golangci-lint-action from 4.0.0 to 6.0.1 (#379)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 4.0.0 to 6.0.1.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](3cfe3a4abb...a4f60bb28d)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-27 17:44:46 -04:00
dependabot[bot]
15617cd936
Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#365)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-27 17:44:28 -04:00
dependabot[bot]
585184769d
Bump actions/cache from 4.0.0 to 4.0.2 (#368)
Bumps [actions/cache](https://github.com/actions/cache) from 4.0.0 to 4.0.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](13aacd865c...0c45773b62)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-27 17:44:10 -04:00
dependabot[bot]
557e170e29
Bump actions/checkout from 4.1.1 to 4.1.6 (#381)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.1...v4.1.6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-27 17:43:55 -04:00
dependabot[bot]
4edb16bfcd
Bump golangci/golangci-lint-action from 3.7.0 to 4.0.0 (#364)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.7.0 to 4.0.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](3a91952989...3cfe3a4abb)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-14 17:45:49 -05:00
dependabot[bot]
649c613fbc
Bump actions/cache from 3.3.2 to 4.0.0 (#360)
Bumps [actions/cache](https://github.com/actions/cache) from 3.3.2 to 4.0.0.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](704facf57e...13aacd865c)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-14 17:45:40 -05:00
Jean-Luc Lacroix
a93533d16c
New date formats for non standard dates returned by LIST (#354) 2024-01-11 14:31:46 -05:00
dependabot[bot]
824fdbc882
Bump coverallsapp/github-action from 2.2.1 to 2.2.3 (#351)
Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 2.2.1 to 2.2.3.
- [Release notes](https://github.com/coverallsapp/github-action/releases)
- [Commits](95b1a2355b...3dfc556739)

---
updated-dependencies:
- dependency-name: coverallsapp/github-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-11 14:30:55 -05:00
dependabot[bot]
678cef9c13
Bump actions/cache from 3.3.1 to 3.3.2 (#352)
Bumps [actions/cache](https://github.com/actions/cache) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](88522ab9f3...704facf57e)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-11 14:30:44 -05:00
dependabot[bot]
d019ddee92
Bump actions/checkout from 3.6.0 to 4.1.1 (#353)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.6.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3.6.0...v4.1.1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-11 14:30:31 -05:00
dependabot[bot]
a9581d60ae
Bump actions/setup-go from 4.1.0 to 5.0.0 (#355)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4.1.0 to 5.0.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](93397bea11...0c52d547c9)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-11 14:30:17 -05:00
dependabot[bot]
f58b250a0a
Bump github/codeql-action from 2 to 3 (#357)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-11 14:30:06 -05:00
dependabot[bot]
bedccfb795
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 (#331)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.3 to 1.8.4.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.3...v1.8.4)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-13 14:57:19 -05:00
Tamás Gulácsi
e44fc64e60
Fix PASV address like lftp does (#349)
Some behind-firewall-and-corporate-network FTP servers
responds their private-net address instead of the
publicly reachable.

This fix checks for such address and uses the
command channel's address instead.
2023-11-13 14:56:59 -05:00
dependabot[bot]
a58dc069db
Bump golangci/golangci-lint-action from 3.4.0 to 3.7.0 (#344)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.4.0 to 3.7.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](08e2f20817...3a91952989)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-13 13:46:08 -05:00
dependabot[bot]
22efdfbe8a
Bump actions/setup-go from 4.0.1 to 4.1.0 (#343)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4.0.1 to 4.1.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](fac708d667...93397bea11)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-13 13:45:53 -05:00
dependabot[bot]
9226fc7f7c
Bump coverallsapp/github-action from 2.1.2 to 2.2.1 (#341)
Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 2.1.2 to 2.2.1.
- [Release notes](https://github.com/coverallsapp/github-action/releases)
- [Commits](f350da2c03...95b1a2355b)

---
updated-dependencies:
- dependency-name: coverallsapp/github-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-13 13:45:36 -05:00
dependabot[bot]
2b809c0747
Bump actions/checkout from 2.4.2 to 3.6.0 (#345)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.2 to 3.6.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.4.2...v3.6.0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-13 13:45:21 -05:00
9 changed files with 92 additions and 23 deletions

View File

@ -41,11 +41,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4.1.7
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@ -66,4 +66,4 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@b398f525a5587552e573b247ac661067fafa920b
uses: github/codeql-action/analyze@64e61baeac852f409b48440cebec029a2d978f90

View File

@ -9,8 +9,8 @@ jobs:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
steps:
- uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e
- uses: actions/checkout@v4.1.7
- name: golangci-lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86
with:
only-new-issues: true

View File

@ -5,12 +5,12 @@ jobs:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089
- uses: actions/checkout@v4.1.7
- name: Setup go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with:
go-version: 1.19
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with:
path: |
~/go/pkg/mod
@ -23,7 +23,7 @@ jobs:
- name: Convert coverage to lcov
uses: jandelgado/gcov2lcov-action@c680c0f7c7442485f1749eb2a13e54a686e76eb5
- name: Coveralls
uses: coverallsapp/github-action@f350da2c033043742f89e8c0b7b5145a1616da6d
uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: coverage.lcov

52
ftp.go
View File

@ -11,6 +11,7 @@ import (
"io"
"net"
"net/textproto"
"regexp"
"strconv"
"strings"
"time"
@ -528,9 +529,26 @@ func (c *ServerConn) pasv() (host string, port int, err error) {
// Make the IP address to connect to
host = strings.Join(pasvData[0:4], ".")
if c.host != host {
if cmdIP := net.ParseIP(c.host); cmdIP != nil {
if dataIP := net.ParseIP(host); dataIP != nil {
if isBogusDataIP(cmdIP, dataIP) {
return c.host, port, nil
}
}
}
}
return host, port, nil
}
func isBogusDataIP(cmdIP, dataIP net.IP) bool {
// Logic stolen from lftp (https://github.com/lavv17/lftp/blob/d67fc14d085849a6b0418bb3e912fea2e94c18d1/src/ftpclass.cc#L769)
return dataIP.IsMulticast() ||
cmdIP.IsPrivate() != dataIP.IsPrivate() ||
cmdIP.IsLoopback() != dataIP.IsLoopback()
}
// getDataConnPort returns a host, port for a new data connection
// it uses the best available method to do so
func (c *ServerConn) getDataConnPort() (string, int, error) {
@ -810,7 +828,7 @@ func (c *ServerConn) CurrentDir() (string, error) {
end := strings.LastIndex(msg, "\"")
if start == -1 || end == -1 {
return "", errors.New("unsuported PWD response format")
return "", errors.New("unsupported PWD response format")
}
return msg[start+1 : end], nil
@ -1076,6 +1094,38 @@ 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(`^[^\/]*(?P<Path>\/.*) \(.*\).*$`)
for _, msg := range strings.Split(message, "\n") {
if re.MatchString(msg) {
msgs = append(msgs, re.ReplaceAllString(msg, "${Path}"))
}
}
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 has no effects and is usually used to prevent the remote FTP server to
// close the otherwise idle connection.

22
ftp_test.go Normal file
View File

@ -0,0 +1,22 @@
package ftp
import (
"net"
"testing"
)
func TestBogusDataIP(t *testing.T) {
for _, tC := range []struct {
cmd, data net.IP
bogus bool
}{
{net.IPv4(192, 168, 1, 1), net.IPv4(192, 168, 1, 1), false},
{net.IPv4(192, 168, 1, 1), net.IPv4(1, 1, 1, 1), true},
{net.IPv4(10, 65, 1, 1), net.IPv4(1, 1, 1, 1), true},
{net.IPv4(10, 65, 25, 1), net.IPv4(10, 65, 8, 1), false},
} {
if got, want := isBogusDataIP(tC.cmd, tC.data), tC.bogus; got != want {
t.Errorf("%s,%s got %t, wanted %t", tC.cmd, tC.data, got, want)
}
}
}

6
go.mod
View File

@ -1,10 +1,10 @@
module github.com/jlaffaye/ftp
module git.siteop.biz/brouzouf/ftp
go 1.17
go 1.23.2
require (
github.com/hashicorp/go-multierror v1.1.1
github.com/stretchr/testify v1.8.3
github.com/stretchr/testify v1.10.0
)
require (

11
go.sum
View File

@ -1,4 +1,3 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
@ -7,15 +6,9 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -24,6 +24,8 @@ var listLineParsers = []parseFunc{
var dirTimeFormats = []string{
"01-02-06 03:04PM",
"2006-01-02 15:04",
"01-02-2006 03:04PM",
"01-02-2006 15:04",
}
// parseRFC3659ListLine parses the style of directory line defined in RFC 3659.

View File

@ -68,7 +68,9 @@ var listTests = []line{
// DOS DIR command output
{"08-07-15 07:50PM 718 Post_PRR_20150901_1166_265118_13049.dat", "Post_PRR_20150901_1166_265118_13049.dat", 718, EntryTypeFile, newTime(2015, time.August, 7, 19, 50)},
{"08-10-15 02:04PM <DIR> Billing", "Billing", 0, EntryTypeFolder, newTime(2015, time.August, 10, 14, 4)},
{"08-07-2015 07:50PM 718 Post_PRR_20150901_1166_265118_13049.dat", "Post_PRR_20150901_1166_265118_13049.dat", 718, EntryTypeFile, newTime(2015, time.August, 7, 19, 50)},
{"08-10-2015 02:04PM <DIR> Billing", "Billing", 0, EntryTypeFolder, newTime(2015, time.August, 10, 14, 4)},
// dir and file names that contain multiple spaces
{"drwxr-xr-x 3 110 1002 3 Dec 02 2009 spaces dir name", "spaces dir name", 0, EntryTypeFolder, newTime(2009, time.December, 2)},
{"-rwxr-xr-x 3 110 1002 1234567 Dec 02 2009 file name", "file name", 1234567, EntryTypeFile, newTime(2009, time.December, 2)},