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


##########
core/src/services/fs/backend.rs:
##########
@@ -566,10 +566,15 @@ impl Accessor for FsBackend {
             (p, None)
         };
 
-        let f = std::fs::OpenOptions::new()
-            .create(true)
-            .truncate(true)
-            .write(true)
+        let mut open_option = std::fs::OpenOptions::new();
+        open_option.create(true).write(true);
+        if args.append() {

Review Comment:
   Think about this case: If `atmoic_write` has been enabled, user trying to 
`append` a file. Current logic will wirte a new file in tmp_path and rename to 
target_path which will overwrite the existing file.



##########
core/src/services/fs/backend.rs:
##########
@@ -566,10 +566,15 @@ impl Accessor for FsBackend {
             (p, None)
         };
 
-        let f = std::fs::OpenOptions::new()
-            .create(true)
-            .truncate(true)
-            .write(true)
+        let mut open_option = std::fs::OpenOptions::new();
+        open_option.create(true).write(true);
+        if args.append() {

Review Comment:
   Think about this case: If `atmoic_write` has been enabled, user trying to 
`append` a file. Current logic will write a new file in tmp_path and rename to 
target_path which will overwrite the existing file.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to