This is an automated email from the ASF dual-hosted git repository.
erickguan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new a590b317c fix(fs/ftp/hdfs): correct tmp_path generation for append
operations (#6327)
a590b317c is described below
commit a590b317c37ace8242ee5a079588787d3e526cdb
Author: Kingsword <[email protected]>
AuthorDate: Tue Jun 24 17:12:40 2025 +0800
fix(fs/ftp/hdfs): correct tmp_path generation for append operations (#6327)
---
core/src/services/fs/core.rs | 2 +-
core/src/services/ftp/backend.rs | 2 +-
core/src/services/hdfs/backend.rs | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/core/src/services/fs/core.rs b/core/src/services/fs/core.rs
index eb29b5e4c..9777f832e 100644
--- a/core/src/services/fs/core.rs
+++ b/core/src/services/fs/core.rs
@@ -128,7 +128,7 @@ impl FsCore {
&& tokio::fs::try_exists(&target_path)
.await
.map_err(new_std_io_error)?;
- let tmp_path = should_append.then_some(tmp_path);
+ let tmp_path = (!should_append).then_some(tmp_path);
Ok((target_path, tmp_path))
} else {
diff --git a/core/src/services/ftp/backend.rs b/core/src/services/ftp/backend.rs
index 24324e072..9d4ece031 100644
--- a/core/src/services/ftp/backend.rs
+++ b/core/src/services/ftp/backend.rs
@@ -299,7 +299,7 @@ impl Access for FtpBackend {
}
}
- let tmp_path = op.append().then_some(build_tmp_path_of(path));
+ let tmp_path = (!op.append()).then_some(build_tmp_path_of(path));
let w = FtpWriter::new(ftp_stream, path.to_string(), tmp_path);
Ok((RpWrite::new(), w))
diff --git a/core/src/services/hdfs/backend.rs
b/core/src/services/hdfs/backend.rs
index 53136ef33..b9af0f9a6 100644
--- a/core/src/services/hdfs/backend.rs
+++ b/core/src/services/hdfs/backend.rs
@@ -300,7 +300,7 @@ impl Access for HdfsBackend {
let should_append = op.append() && target_exists;
let tmp_path =
self.atomic_write_dir.as_ref().and_then(|atomic_write_dir| {
// If the target file exists, we should append to the end of it
directly.
- should_append.then_some(build_rooted_abs_path(
+ (!should_append).then_some(build_rooted_abs_path(
atomic_write_dir,
&build_tmp_path_of(path),
))