Skip to content

Commit

Permalink
feat(services/ftp): List dir shows last modified timestamp (#5213)
Browse files Browse the repository at this point in the history
Co-authored-by: Erick Guan <[email protected]>
  • Loading branch information
erickguan and erickguan authored Oct 20, 2024
1 parent 6e0508d commit fa08fbe
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 fa08fbe

Please sign in to comment.