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/04/03 09:08:00 UTC

[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #1845: fix(core): necessary operations before doing copy

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


##########
core/src/services/fs/backend.rs:
##########
@@ -443,12 +443,14 @@ impl Accessor for FsBackend {
     }
 
     async fn copy(&self, from: &str, to: &str, _args: OpCopy) -> Result<RpCopy> {
-        tokio::fs::copy(
-            self.root.join(from.trim_end_matches('/')),
-            self.root.join(to.trim_end_matches('/')),
-        )
-        .await
-        .map_err(parse_io_error)?;
+        let from = self.root.join(from.trim_end_matches('/'));
+
+        // try to get the metadata of the source file to ensure it exists

Review Comment:
   Why do we need to check this? Will `copy` already return `not found`?



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