This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch fix-stat
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/fix-stat by this push:
     new c848d91be Fix webdav
c848d91be is described below

commit c848d91be1cc3b4b0c269bf25e531ffb4cdbbbe5
Author: Xuanwo <[email protected]>
AuthorDate: Thu Nov 23 13:38:16 2023 +0800

    Fix webdav
    
    Signed-off-by: Xuanwo <[email protected]>
---
 core/src/services/webdav/backend.rs | 5 -----
 core/src/services/webdav/lister.rs  | 5 +++--
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/core/src/services/webdav/backend.rs 
b/core/src/services/webdav/backend.rs
index 639353e45..1361a11fd 100644
--- a/core/src/services/webdav/backend.rs
+++ b/core/src/services/webdav/backend.rs
@@ -326,11 +326,6 @@ impl Accessor for WebdavBackend {
     }
 
     async fn stat(&self, path: &str, _: OpStat) -> Result<RpStat> {
-        // Stat root always returns a DIR.
-        if path == "/" {
-            return Ok(RpStat::new(Metadata::new(EntryMode::DIR)));
-        }
-
         let mut header_map = HeaderMap::new();
         // not include children
         header_map.insert("Depth", "0".parse().unwrap());
diff --git a/core/src/services/webdav/lister.rs 
b/core/src/services/webdav/lister.rs
index e98c77db3..adca8ef6b 100644
--- a/core/src/services/webdav/lister.rs
+++ b/core/src/services/webdav/lister.rs
@@ -87,7 +87,6 @@ pub struct ListOpResponse {
 impl ListOpResponse {
     pub fn parse_into_metadata(&self) -> Result<Metadata> {
         let ListOpResponse {
-            href,
             propstat:
                 Propstat {
                     prop:
@@ -96,10 +95,12 @@ impl ListOpResponse {
                             getcontentlength,
                             getcontenttype,
                             getetag,
+                            resourcetype,
                             ..
                         },
                     status,
                 },
+            ..
         } = self;
         if let [_, code, text] = status.split(' ').collect::<Vec<_>>()[..3] {
             // As defined in https://tools.ietf.org/html/rfc2068#section-6.1
@@ -112,7 +113,7 @@ impl ListOpResponse {
             }
         }
 
-        let mode: EntryMode = if href.ends_with('/') {
+        let mode: EntryMode = if resourcetype.value == 
Some(ResourceType::Collection) {
             EntryMode::DIR
         } else {
             EntryMode::FILE

Reply via email to