This is an automated email from the ASF dual-hosted git repository. xuanwo pushed a commit to branch fix-stat in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
commit 8b3405faefa764a38bf48ae7d3b0ebe5d8ad1a75 Author: Xuanwo <[email protected]> AuthorDate: Wed Nov 22 19:03:12 2023 +0800 Fix ftp Signed-off-by: Xuanwo <[email protected]> --- core/src/services/ftp/backend.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/services/ftp/backend.rs b/core/src/services/ftp/backend.rs index c5ad50f05..37305347f 100644 --- a/core/src/services/ftp/backend.rs +++ b/core/src/services/ftp/backend.rs @@ -417,6 +417,15 @@ impl Accessor for FtpBackend { } else { EntryMode::Unknown }; + + // Return not found if the path ends with `/` but meta is dir. + if path.ends_with('/') && mode == EntryMode::FILE { + return Err(Error::new( + ErrorKind::NotFound, + "given path is not a directory", + )); + } + let mut meta = Metadata::new(mode); meta.set_content_length(file.size() as u64); meta.set_last_modified(file.modified().into());
