apache / apache/mina-ftpserver

NLST returning non-empty listing for non-existent files

Open
#80 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
67
Forks
38
PR merge metrics
No merged PRs in 30d

Description

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):
```java
@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()));
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.