Add forceListHidden dial option to force the use of 'LIST -a' command (#271)

This is useful for servers that do not offer up
hidden folders/files by default when using LIST/MLSD
commands.
Setting forceListHidden to true will force the use of
the 'LIST -a' command even when MLST support has
been detected.
This commit is contained in:
Øyvind Heddeland Instefjord
2022-09-04 20:43:06 +02:00
committed by GitHub
parent b85cf1edcc
commit 99be0634ab
3 changed files with 42 additions and 14 deletions

View File

@@ -295,6 +295,20 @@ func TestListCurrentDir(t *testing.T) {
mock.Wait()
}
func TestListCurrentDirWithForceListHidden(t *testing.T) {
mock, c := openConnExt(t, "127.0.0.1", "no-time", DialWithDisabledMLSD(true), DialWithForceListHidden(true))
assert.True(t, c.options.forceListHidden)
_, err := c.List("")
assert.NoError(t, err)
assert.Equal(t, "LIST -a", mock.lastFull, "LIST -a must not have a trailing whitespace")
err = c.Quit()
assert.NoError(t, err)
mock.Wait()
}
func TestTimeUnsupported(t *testing.T) {
mock, c := openConnExt(t, "127.0.0.1", "no-time")