You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "fadflka (via GitHub)" <gi...@apache.org> on 2025/12/26 09:33:54 UTC
[I] bug: Onedrive service `list("/")` returns empty result due to incorrect URL construction [opendal]
fadflka opened a new issue, #7102:
URL: https://github.com/apache/opendal/issues/7102
### Describe the bug
## Describe the bug
When using the Onedrive service to list the root directory (`"/"`), the `list()` method returns an empty vector, even though files exist in the root directory and `read()` works correctly.
## Steps to reproduce
```rust
use opendal::{Result, Operator};
#[tokio::main]
async fn main() -> Result<()> {
let mut builder = opendal::services::Onedrive::default();
builder = builder.access_token("<valid_access_token>");
builder = builder.client_id("<client_id>");
builder = builder.client_secret("<client_secret>");
let op = Operator::new(builder)?.finish();
// This returns empty []
let entries = op.list("/").await?;
println!("entries: {:?}", entries.len()); // Output: 0
// But reading a file that exists works fine
let content = op.read("/6g.txt").await?;
println!("read success, {} bytes", content.len()); // Output: 5869 bytes
Ok(())
}
```
### Steps to Reproduce
```rust
let mut builder = opendal::services::Onedrive::default();
builder = builder.access_token("<valid_access_token>");
builder = builder.client_id("<client_id>");
builder = builder.client_secret("<client_secret>");
let op = Operator::new(builder)?.finish();
// This returns empty []
let entries = op.list("/").await?;
println!("entries: {:?}", entries.len()); // Output: 0
```
### Expected Behavior
op.list("/") should return the list of files and directories in the OneDrive root folder.
### Additional Context
_No response_
### Are you willing to submit a PR to fix this bug?
- [ ] Yes, I would like to submit a PR.
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: Onedrive service `list("/")` returns empty result due to incorrect URL construction [opendal]
Posted by "erickguan (via GitHub)" <gi...@apache.org>.
erickguan closed issue #7102: bug: Onedrive service `list("/")` returns empty result due to incorrect URL construction
URL: https://github.com/apache/opendal/issues/7102
--
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: [I] bug: Onedrive service `list("/")` returns empty result due to incorrect URL construction [opendal]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #7102:
URL: https://github.com/apache/opendal/issues/7102#issuecomment-3692561260
<!-- Greeting -->
Hi @fadflka! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the opendal team.
<!-- Answer -->
This issue is likely caused by how OpenDAL constructs the path or URL for the root directory when calling list on the Onedrive service. There are known problems in OpenDAL where directory operations like LIST require a trailing slash or specific path formatting, and incorrect handling can cause listing to fail or return empty results—even when files exist and read operations work fine. This has been observed in other services and is suspected to affect Onedrive as well. You may want to experiment with using an explicit trailing slash (e.g., `list("/")` vs `list("")` or `list("./")`), but a code fix in the Onedrive backend may be needed to handle root directory listing correctly. See related discussion and similar issues [here](https://github.com/apache/opendal/issues/5394) and [here](https://github.com/apache/opendal/issues/5775).
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
---
<sup>How did I do? [Good](https://app.dosu.dev/response-feedback/f6824a7e-7597-42b0-98d1-1a173c62e18a?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/f6824a7e-7597-42b0-98d1-1a173c62e18a?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/f6824a7e-7597-42b0-98d1-1a173c62e18a?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/f6824a7e-7597-42b0-98d1-1a173c62e18a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f6824a7e-7597-42b0-98d1-1a173c62e18a?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/f6824a7e-7597-42b0-98d1-1a173c62e18a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f6824a7e-7597-42b0-98d1-1a173c62e18a?feedback_type=other)</sup>
[](https://app.dosu.dev/997a2c5a-0c54-497b-989d-44651635dd36/ask?utm_source=github) [](https://cursor.com/link/prompt?text=This%20issue%20is%20likely%20caused%20by%20how%20OpenDAL%20constructs%20the%20path%20or%20URL%20for%20the%20root%20directory%20when%20calling%20list%20on%20the%20Onedrive%20service.%20There%20are%20known%20problems%20in%20OpenDAL%20where%20directory%20operations%20like%20LIST%20require%20a%20trailing%20slash%20or%20specific%20path%20formatting%2C%20and%20incorrect%20handling%20can%20cause%20listing%20to%20fail%20or%20return%20empty%20results%E2%80%94even%20when%20files%20exist%20and%20read%20operations%20work%20fine.%20This%20has%20been%20observed%20in%20other%20services%20and%20is%20suspected%20to%20affect%20Onedrive%20as%20well.%20You%20may%20want%20to%20experiment%20with%20using%20an%20explicit%20trailing%20slash%20%28e.g.%2C%20%60list%28%22/%22
%29%60%20vs%20%60list%28%22%22%29%60%20or%20%60list%28%22./%22%29%60%29%2C%20but%20a%20code%20fix%20in%20the%20Onedrive%20backend%20may%20be%20needed%20to%20handle%20root%20directory%20listing%20correctly.%20See%20related%20discussion%20and%20similar%20issues%20%5Bhere%5D%28https%3A//github.com/apache/opendal/issues/5394%29%20and%20%5Bhere%5D%28https%3A//github.com/apache/opendal/issues/5775%29.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/opendal/issues/7102)
--
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: [I] bug: Onedrive service `list("/")` returns empty result due to incorrect URL construction [opendal]
Posted by "Somsubhra-Nandi (via GitHub)" <gi...@apache.org>.
Somsubhra-Nandi commented on issue #7102:
URL: https://github.com/apache/opendal/issues/7102#issuecomment-3701548511
@dosu Thanks for the pointers!
I can reproduce the issue consistently: `list("/")` on the OneDrive service returns an empty result, while reading files from root works as expected.
From investigation, this seems to be a root-path handling issue in the OneDrive backend. The OneDrive API treats root differently (`/me/drive/root/children`) compared to subpaths (`/me/drive/root:/path:/children`). Currently, the root path appears to be formatted like a normal directory path, which causes the API to return an empty list.
I’m working on a fix to special-case the root directory during list operations and will also add a regression test to ensure `list("/")` works correctly.
I’ll open a PR once the fix is ready.
--
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