Skip to content

Commit

Permalink
feat(services/ftp): List dir shows last modified timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
erickguan committed Oct 20, 2024
1 parent 32ddf46 commit 2d74583
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions core/src/services/ftp/lister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,22 @@ impl oio::List for FtpLister {

let path = self.path.to_string() + de.name();

let mut meta = if de.is_file() {
Metadata::new(EntryMode::FILE)
} else if de.is_directory() {
Metadata::new(EntryMode::DIR)
} else {
Metadata::new(EntryMode::Unknown)
};
meta.set_content_length(de.size() as u64);
meta.set_last_modified(de.modified().into());

let entry = if de.is_file() {
oio::Entry::new(
&path,
Metadata::new(EntryMode::FILE)
.with_content_length(de.size() as u64)
.with_last_modified(de.modified().into()),
)
oio::Entry::new(&path, meta)
} else if de.is_directory() {
oio::Entry::new(&format!("{}/", &path), Metadata::new(EntryMode::DIR))
oio::Entry::new(&format!("{}/", &path), meta)
} else {
oio::Entry::new(&path, Metadata::new(EntryMode::Unknown))
oio::Entry::new(&path, meta)
};

Ok(Some(entry))
Expand Down

0 comments on commit 2d74583

Please sign in to comment.