Skip to content

Commit 9dbe313

Browse files
committed
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>
1 parent e233636 commit 9dbe313

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/basic_memory/cli/commands/cloud/rclone_commands.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,10 @@ def project_copy_file(
471471
f"{source_root}/{source_rel_path}",
472472
f"{dest_root}/{dest_rel_path}",
473473
*TIGRIS_CONSISTENCY_HEADERS,
474+
# Matches _build_transfer_cmd: on pull this writes the conflict copy to
475+
# the local filesystem, where this prevents NUL byte padding on virtual
476+
# filesystems (e.g. Google Drive File Stream). See rclone/rclone#6801.
477+
"--local-no-preallocate",
474478
]
475479
if verbose:
476480
cmd.append("--verbose")

tests/test_rclone_commands.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,8 @@ def test_project_copy_file_pull_copyto_renames_on_dest(tmp_path):
721721
assert cmd[:2] == ["rclone", "copyto"]
722722
assert cmd[2] == "basic-memory-cloud:my-bucket/research/notes/dup.md"
723723
assert cmd[3] == "/tmp/research/notes/dup.conflict-S.md"
724+
# pull writes the conflict copy locally → must guard virtual-FS NUL padding
725+
assert "--local-no-preallocate" in cmd
724726

725727

726728
def test_project_transfer_keep_both_copies_conflicts_then_additive(tmp_path):

0 commit comments

Comments
 (0)