ftpd: add basic wildcard support

this is the minimal implementation to allow mget and similar commands with
wildcards.

We only support wildcard for the last path level, for example:

- mget *.xml is supported
- mget dir/*.xml is supported
- mget */*.xml is not supported

Removed . and .. from FTP directory listing

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-05-04 19:32:02 +02:00
parent 9a37e3d159
commit 61947e67ae
6 changed files with 225 additions and 41 deletions

View File

@@ -57,9 +57,9 @@ func TestBasicFTPHandlingCryptFs(t *testing.T) {
}
list, err := client.List(".")
if assert.NoError(t, err) {
assert.Len(t, list, 2)
assert.Equal(t, ".", list[0].Name)
assert.Equal(t, testFileSize, int64(list[1].Size))
if assert.Len(t, list, 1) {
assert.Equal(t, testFileSize, int64(list[0].Size))
}
}
user, _, err = httpdtest.GetUserByUsername(user.Username, http.StatusOK)
assert.NoError(t, err)