Skip to content

NLST returning non-empty listing for non-existent files #80

Description

@anowicki-egnyte

The NLST FTP command, when issued with the name of a non-existent file as an argument, returns that name instead of an empty list. Compare this behavior to that of the LIST command, which correctly returns an empty list in such a case.

A test case reproducing the bug (using the FTP client from the commons-net package):

    @Test
    void shouldReturnEmptyListingOfNonExistingFiles() {
        ftpClient.connect(IP, PORT);
        ftpClient.login(USERNAME, PASSWORD);
        ftpClient.enterLocalPassiveMode();

        // this assertion passes
        assertThat(ftpClient.listFiles(UUID.randomUUID().toString()), is(emptyArray()));
        // while this one fails
        assertThat(ftpClient.listNames(UUID.randomUUID().toString()), is(emptyArray()));
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions