Skip to content

Commit

Permalink
fix integrations/fuse3
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorgan committed Aug 20, 2024
1 parent fc0b69e commit 3f1b720
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion integrations/fuse3/src/file_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use fuse3::Result;
use futures_util::stream;
use futures_util::stream::BoxStream;
use futures_util::StreamExt;
use opendal::raw::normalize_path;
use opendal::EntryMode;
use opendal::ErrorKind;
use opendal::Metadata;
Expand Down Expand Up @@ -575,11 +576,21 @@ impl PathFilesystem for Filesystem {

let mut current_dir = PathBuf::from(path);
current_dir.push(""); // ref https://users.rust-lang.org/t/trailing-in-paths/43166
let path = current_dir.to_string_lossy().to_string();
let children = self
.op
.lister(&current_dir.to_string_lossy())
.await
.map_err(opendal_error2errno)?
.filter_map(move |entry| {
let dir = normalize_path(path.as_str());
async move {
match entry {
Ok(e) if e.path() == dir => None,
_ => Some(entry),
}
}
})
.enumerate()
.map(|(i, entry)| {
entry
Expand Down Expand Up @@ -697,12 +708,22 @@ impl PathFilesystem for Filesystem {
let uid = self.uid;
let gid = self.gid;

let path = current_dir.to_string_lossy().to_string();
let children = self
.op
.lister_with(&current_dir.to_string_lossy())
.lister_with(&path)
.metakey(Metakey::ContentLength | Metakey::LastModified | Metakey::Mode)
.await
.map_err(opendal_error2errno)?
.filter_map(move |entry| {
let dir = normalize_path(path.as_str());
async move {
match entry {
Ok(e) if e.path() == dir => None,
_ => Some(entry),
}
}
})
.enumerate()
.map(move |(i, entry)| {
entry
Expand Down

0 comments on commit 3f1b720

Please sign in to comment.