Skip to content

Commit

Permalink
fixup! Get metadata from inner stat metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
erickguan committed Oct 27, 2024
1 parent 489508a commit d6d3044
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions core/src/layers/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ impl<A: Access> CompleteAccessor<A> {
}

if path == "/" {
let meta = self.inner.stat(path, args).await?.into_metadata();
let meta = if capability.stat {
self.inner.stat(path, args).await?.into_metadata()
} else {
Metadata::new(EntryMode::DIR)
};
return Ok(RpStat::new(meta));
}

Expand All @@ -199,13 +203,13 @@ impl<A: Access> CompleteAccessor<A> {
.list(path, OpList::default().with_recursive(true).with_limit(1))
.await?;

if let Some(entry) = oio::List::next(&mut l).await? {
return Ok(RpStat::new(entry.into_entry().metadata().clone()));
return if oio::List::next(&mut l).await?.is_some() {
Ok(RpStat::new(Metadata::new(EntryMode::DIR)))
} else {
return Err(Error::new(
Err(Error::new(
ErrorKind::NotFound,
"the directory is not found",
));
))
};
}

Expand Down

0 comments on commit d6d3044

Please sign in to comment.