Skip to content

bug: Onedrive service list("/") returns empty result due to incorrect URL construction #7102

@fadflka

Description

@fadflka

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

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

 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions