You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2023/03/28 04:19:39 UTC

[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #1783: fix: align WebDAV stat with RFC specification

Xuanwo commented on code in PR #1783:
URL: https://github.com/apache/incubator-opendal/pull/1783#discussion_r1150007362


##########
core/src/services/webdav/backend.rs:
##########
@@ -322,18 +324,40 @@ impl Accessor for WebdavBackend {
             return Ok(RpStat::new(Metadata::new(EntryMode::DIR)));
         }
 
-        let resp = self.webdav_head(path).await?;
+        let mut header_map = HeaderMap::new();
+        // not include children
+        header_map.insert("Depth", "0".parse().unwrap());
+        header_map.insert(
+            header::ACCEPT,
+            "text/plain,application/xml".parse().unwrap(),
+        );
+
+        let resp = self.webdav_propfind(path, Some(header_map)).await?;
 
         let status = resp.status();
 
-        match status {
-            StatusCode::OK => parse_into_metadata(path, resp.headers()).map(RpStat::new),
-            // HTTP Server like nginx could return FORBIDDEN if auto-index

Review Comment:
   **Suggestion**: It would be preferable to leave the comments in this location.



##########
core/src/services/webdav/backend.rs:
##########
@@ -322,18 +324,40 @@ impl Accessor for WebdavBackend {
             return Ok(RpStat::new(Metadata::new(EntryMode::DIR)));
         }
 
-        let resp = self.webdav_head(path).await?;
+        let mut header_map = HeaderMap::new();
+        // not include children
+        header_map.insert("Depth", "0".parse().unwrap());
+        header_map.insert(
+            header::ACCEPT,
+            "text/plain,application/xml".parse().unwrap(),

Review Comment:
   **request-change**: accept `text/plain` is wrong as we can't parse plain response.



-- 
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