Skip to content

Creating empty file with writer in webdav for owncloud fails #3014

@prabirshrestha

Description

@prabirshrestha

Repro steps:

  • Create an empty file locally in your machine - emptyfile.txt
  • Go to https://demo.owncloud.com and login with demo as username and password.
  • Upload the empty file and see it created.

Now do the same but with opendal webdav backend and verify in demo.owncloud.com website. The emptyfile doesn't exist as it seems to fail creating empty file. update let data = b" "; to contain empty space and it works.

let mut builder = opendal::services::Webdav::default();

builder
    .endpoint("https://demo.owncloud.com/remote.php/dav/files/demo/")
    .username("demo")
    .password("demo")
    .root("/");

let data = b"";
let stream = tokio_util::io::ReaderStream::new(&data[..]);
let mut reader = tokio_util::io::StreamReader::new(stream);

let op = Operator::new(builder).unwrap().finish();
let mut writer = op
    .writer_with("/emptyfile.txt")
    .content_length(data.len() as u64)
    .await
    .unwrap();
tokio::io::copy(&mut reader, &mut writer).await.unwrap();
writer.close().await.unwrap();

dependencies:

[dependencies]
opendal = "0.39.0"
tokio = { version = "1.32.0", features = ["macros", "rt-multi-thread"] }
tokio-util = { version = "0.7.8", features = ["io"] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions