Open Marv-CZ opened 3 years ago
I found out it's not general problem, but only ftpd server from busybox which I used for testing.
For non-existent dirname:
BusyBox ftpd LIST dirname returns data "dirname: No such file or directory" and "226 Transfer complete" list('dirname', cb) returns [ 'dirname: No such file or directory' ] rmdir('dirname', true, cb) produces TypeError
Pure-FTPD LIST dirname returns empty data and "226 0 matches total" list('dirname', cb) returns [] rmdir('dirname', true, cb) returns error
ProFTPD LIST dirname returns "450 dirname: No such file or directory" list('dirname', cb) returns error with message "dirname: No such file or directory" rmdir('dirname', true, cb) returns error
When you call rmdir() with recursive=true on a non-existent directory it causes:
rmdir() calls list() which returns "No such file or directory" string instead a error and rmdir() tries to use it as a dir item.
I have replaced list() with listSafe() which is able to return the error, but it has bug too. It doesn't test missing optional arguments. So this patch also solves this issue.