You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "PDGGK (via GitHub)" <gi...@apache.org> on 2026/08/15 07:45:53 UTC
[PR] fix(services/dbfs): make listed entry paths relative to the root [opendal]
PDGGK opened a new pull request, #8083:
URL: https://github.com/apache/opendal/pull/8083
### Which issue does this PR close?
None. This is the second half of #8079, kept separate because it changes what users see rather than what goes on the wire.
### Rationale for this change
The lister emits `status.path` straight from the response:
```rust
for status in decoded_response.files {
let entry: oio::Entry = match status.is_dir {
true => {
let normalized_path = format!("{}/", status.path);
...
oio::Entry::new(&normalized_path, meta)
}
false => {
...
oio::Entry::new(&status.path, meta)
}
};
```
`DbfsCore::list` sends the prefix as `build_rooted_abs_path(&self.root, path)`, and DBFS echoes absolute paths under that prefix. So every entry comes back carrying the root and a leading slash — `/data/dir/f.txt` where the entry contract asks for `dir/f.txt`. Even at the default root the leading slash is wrong.
`alluxio` is the exact analogue in this tree — same API shape, appends `/` for directories, then relativises:
```rust
let path = if file_info.folder { format!("{path}/") } else { path };
ctx.entries.push_back(Entry::new(
&build_rel_path(&self.core.root, &path),
file_info.try_into()?,
));
```
Every other HTTP service lister does the same; dbfs is the only one that omits it. Nothing downstream repairs it either — `oio::Entry::with` only rewrites the empty string to `"/"`.
### What changes are included in this PR?
`build_rel_path` applied once per entry, hoisted above the `match` because both arms need it. Three lines.
### Tests
None — the change makes this lister do what `alluxio` and the rest already do, and there is no directory under `.github/services` for dbfs, so nothing exercises the listing path either way.
`cargo build`, `cargo clippy -p opendal-service-dbfs --all-targets` (zero warnings) and `cargo fmt --all -- --check` are clean.
### Are there any user-facing changes?
Yes: listed entries are relative to the operator root, as the entry contract requires, instead of carrying the root and a leading slash.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(services/dbfs): make listed entry paths relative to the root [opendal]
Posted by "erickguan (via GitHub)" <gi...@apache.org>.
erickguan merged PR #8083:
URL: https://github.com/apache/opendal/pull/8083
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org