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

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


The following commit(s) were added to refs/heads/main by this push:
     new 5ffd40a94 fix(oay): pass litmus copymove test (#2944)
5ffd40a94 is described below

commit 5ffd40a94ec419999a3fdd7214db33f333f794da
Author: Flash <[email protected]>
AuthorDate: Mon Aug 28 15:04:12 2023 +0800

    fix(oay): pass litmus copymove test (#2944)
    
    * pass litmus copymove test
    
    * update
    
    * update
---
 bin/oay/src/services/webdav/webdavfs.rs | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/bin/oay/src/services/webdav/webdavfs.rs 
b/bin/oay/src/services/webdav/webdavfs.rs
index b02dfb30a..b4167dbaa 100644
--- a/bin/oay/src/services/webdav/webdavfs.rs
+++ b/bin/oay/src/services/webdav/webdavfs.rs
@@ -25,6 +25,7 @@ use dav_server::fs::DavDirEntry;
 use dav_server::fs::DavFile;
 use dav_server::fs::DavFileSystem;
 use dav_server::fs::DavMetaData;
+use dav_server::fs::FsError;
 use futures::FutureExt;
 use futures_util::Stream;
 use futures_util::StreamExt;
@@ -146,8 +147,13 @@ impl DavFileSystem for WebdavFs {
 
     fn copy<'a>(&'a self, from: &'a DavPath, to: &'a DavPath) -> 
dav_server::fs::FsFuture<()> {
         async move {
+            let from_path = from
+                .as_rel_ospath()
+                .to_str()
+                .ok_or(FsError::GeneralFailure)?;
+            let to_path = 
to.as_rel_ospath().to_str().ok_or(FsError::GeneralFailure)?;
             self.op
-                .copy(&from.as_url_string(), &to.as_url_string())
+                .copy(from_path, to_path)
                 .await
                 .map_err(convert_error)
         }
@@ -156,8 +162,16 @@ impl DavFileSystem for WebdavFs {
 
     fn rename<'a>(&'a self, from: &'a DavPath, to: &'a DavPath) -> 
dav_server::fs::FsFuture<()> {
         async move {
+            let from_path = from
+                .as_rel_ospath()
+                .to_str()
+                .ok_or(FsError::GeneralFailure)?;
+            let to_path = 
to.as_rel_ospath().to_str().ok_or(FsError::GeneralFailure)?;
+            if from.is_collection() {
+                let _ = self.remove_file(to).await;
+            }
             self.op
-                .rename(from.as_url_string().as_str(), 
to.as_url_string().as_str())
+                .rename(from_path, to_path)
                 .await
                 .map_err(convert_error)
         }

Reply via email to