Skip to content

Commit

Permalink
enable read for webdav
Browse files Browse the repository at this point in the history
Signed-off-by: suyanhanx <suyanhanx@gmail.com>
  • Loading branch information
suyanhanx committed Apr 27, 2023
1 parent c084c60 commit 3902a2d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions core/src/services/webdav/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,18 @@ impl Accessor for WebdavBackend {
ma.set_scheme(Scheme::Webdav)
.set_root(&self.root)
.set_capability(Capability {
stat: true,

read: true,
read_can_next: true,
read_with_if_match: true,
read_with_if_none_match: true,

write: true,
list: true,
copy: true,
rename: true,

..Default::default()
});

Expand Down Expand Up @@ -430,6 +436,8 @@ impl WebdavBackend {
&self,
path: &str,
range: BytesRange,
if_match: Option<&str>,
if_none_match: Option<&str>,
) -> Result<Response<IncomingAsyncBody>> {
let p = build_rooted_abs_path(&self.root, path);

Expand All @@ -445,6 +453,13 @@ impl WebdavBackend {
req = req.header(header::RANGE, range.to_header());
}

if let Some(etag) = if_match {
req = req.header(header::IF_MATCH, etag);
}
if let Some(etag) = if_none_match {
req = req.header(header::IF_NONE_MATCH, etag);
}

let req = req
.body(AsyncBody::Empty)
.map_err(new_request_build_error)?;
Expand Down

0 comments on commit 3902a2d

Please # to comment.