Skip to content

Make replacement transfers failure-safe instead of deleting destinations first #7

Closed

Description

@l0gicgate

Security/data-integrity problem

Replacement currently permanently deletes the destination before the new copy or move has succeeded.

Relevant code: src/adapters/local_operations.rs:208-249.

A failed, cancelled, disk-full, or disconnected transfer can destroy the original destination and leave an incomplete or absent replacement. In addition, the request-wide overwrite_existing flag can apply replacement behavior to an item whose destination appeared after the UI performed its collision check.

Proposed work

  • Track the user's replace/skip decision per source item rather than with one request-wide boolean.
  • For local files, copy to a uniquely named temporary sibling first.
  • Flush/close the staged output as appropriate, then atomically rename/exchange it into place.
  • Do not remove the prior destination until staging succeeds.
  • Define safe behavior for directory replacement/merge and remote GIO backends where atomic replacement is unavailable.
  • Preserve the original destination and report a failure when safe replacement cannot be guaranteed.
  • Clean up abandoned staging files after failures/cancellation.

Acceptance criteria

  • Injected copy/move failures do not lose or modify the original destination.
  • Disk-full and cancellation tests verify preservation of the destination.
  • A destination created after collision confirmation is not silently overwritten.
  • Multi-item transfers honor each item's explicit conflict decision.

Activity

  1. added
    bug
    on Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions