libunftp
libunftp copied to clipboard
Stat on empty dir yields unwrap() error
Got this error with Cyberduck after creating an empty dir and trying to open it.
thread 'tokio-runtime-worker' panicked at 'called `Option::unwrap()` on a `None` value', /Users/rkleingunnewiek/unFTP/libunftp/src/server/controlchan/codecs.rs:61:45
Cyberduck uses STAT
to list directory contents. This makes sense cause it avoids the need for LIST (and a separate data channel). This needs to return a multi line response. But the encoder doesn't expect an empty directory. It does an unwrap() on an Option. https://github.com/bolcom/libunftp/blob/master/src/server/controlchan/codecs.rs#L61
To reproduce:
lftp localhost:/> quote stat /emptydir
2022-06-20 22:28:56 ---> TYPE I
2022-06-20 22:28:56 <--- 200 Always in binary mode
2022-06-20 22:28:56 ---> stat /emptydir
2022-06-20 22:28:56 **** Peer closed connection
Fixed in v0.18.5