apache / apache/opendal

new feature: Relax stat to properly differentiate between directory and file

Open
#6,761 2 comments 1 reaction 0 assignees View on GitHub
enhancement releases-note/feat
Dominant language
Rust
Stars
5.4k
Forks
825
Avg merge
1d 14m
Merged PRs (30d)
127

Description

### Feature Description

Maybe we can relax it a bit for a service that if `abc` is a dir, we return the correct metadata instead of just a `NotFound` error.

### Problem and Solution

For an arbitrary path, `op.stat` expects the user to know whether its a file or directory beforehand so that it can be passed as "a/b/c/" or "a/b/c" or "/a/b/c". the metadata will accordingly contain the mode and if passed incorrectly, stat returns `NotFound` error.

This kind of defeats the purpose of returning `EntryMode` in metadata, and currently there is no deterministic way to directly check if its a file or directory.

### Additional Context

discussed on [discord thread](https://discord.com/channels/1081052318650339399/1434894505836023930).

### Are you willing to contribute to the development of this feature?

- [ ] Yes, I am willing to contribute to the development of this feature.

Contributor guide

Open the contributing guide

Research direction

Start with the op.stat API and EntryMode metadata behavior; no repository files or tests are named, so locate the stat implementation and service-specific behavior first. Compare file and directory paths such as abc, a/b/c, and /a/b/c, then define tests that verify deterministic metadata instead of NotFound when the path type is omitted or mismatched.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.