libunftp icon indicating copy to clipboard operation
libunftp copied to clipboard

Stat on empty dir yields unwrap() error

Open robklg opened this issue 2 years ago • 1 comments

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

robklg avatar Jun 20 '22 20:06 robklg

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 

robklg avatar Jun 20 '22 20:06 robklg

Fixed in v0.18.5

hannesdejager avatar Sep 23 '22 21:09 hannesdejager