fix(cli): add --local-no-preallocate to conflict-copy copyto

Code-review finding: project_copy_file built its `rclone copyto` command
inline and omitted `--local-no-preallocate`. On a `pull --on-conflict keep-both`
that copyto writes the conflict copy to the local filesystem, which is exactly
the case the flag guards (NUL byte padding on virtual filesystems such as
Google Drive File Stream). Every other transfer path adds it via
_build_transfer_cmd; bring copyto in line.

Signed-off-by: phernandez <paul@basicmachines.co>
This commit is contained in:
phernandez
2026-06-08 11:44:20 -05:00
parent e23363606a
commit 9dbe313193
2 changed files with 6 additions and 0 deletions
@@ -471,6 +471,10 @@ def project_copy_file(
f"{source_root}/{source_rel_path}",
f"{dest_root}/{dest_rel_path}",
*TIGRIS_CONSISTENCY_HEADERS,
# Matches _build_transfer_cmd: on pull this writes the conflict copy to
# the local filesystem, where this prevents NUL byte padding on virtual
# filesystems (e.g. Google Drive File Stream). See rclone/rclone#6801.
"--local-no-preallocate",
]
if verbose:
cmd.append("--verbose")
+2
View File
@@ -721,6 +721,8 @@ def test_project_copy_file_pull_copyto_renames_on_dest(tmp_path):
assert cmd[:2] == ["rclone", "copyto"]
assert cmd[2] == "basic-memory-cloud:my-bucket/research/notes/dup.md"
assert cmd[3] == "/tmp/research/notes/dup.conflict-S.md"
# pull writes the conflict copy locally → must guard virtual-FS NUL padding
assert "--local-no-preallocate" in cmd
def test_project_transfer_keep_both_copies_conflicts_then_additive(tmp_path):