Skip to content

Add upload verification tokens and ghost file rollback#5

Open
pwnorbitals wants to merge 1 commit intorclone:masterfrom
pwnorbitals:fix/upload-verification-token
Open

Add upload verification tokens and ghost file rollback#5
pwnorbitals wants to merge 1 commit intorclone:masterfrom
pwnorbitals:fix/upload-verification-token

Conversation

@pwnorbitals
Copy link

Summary

Fixes two issues with Proton Drive uploads:

  • Per-block verification tokens (fixes Code=200501 upload failures): Proton's API now requires calling the verification endpoint before uploading blocks and including a Verifier.Token per block, computed by XORing the verification code with the first 32 bytes of each encrypted block. Also passes VolumeID in the block upload request.
  • Ghost file rollback on upload failure: When block upload (step 2) or revision commit (step 3) fails, the draft link is now permanently deleted via DeleteChildren to prevent ghost entries that block future uploads with the same filename. Also handles corrupted active links in handleRevisionConflict by deleting them when replace_existing_draft is enabled.

Context

Since late 2025, Proton has been rolling out a breaking change to their block upload API. This PR implements the client-side changes needed in the API bridge. See rclone/rclone#8870 and forum discussion.

Depends on rclone/go-proton-api#7 (verification endpoint support).

Test plan

  • Upload a small text file to Proton Drive via rclone
  • Upload a file larger than 4 MB (multi-block)
  • Simulate a block upload failure and verify the draft is cleaned up (no ghost entry)
  • Verify replace_existing_draft=true handles corrupted active links

Made with the help of Claude Opus 4.6 (claude-opus-4-6)

Fixes two issues with Proton Drive uploads:

1. Per-block verification tokens (fixes Code=200501 upload failures):
   Proton's API now requires calling the verification endpoint before
   uploading blocks and including a Verifier.Token per block computed
   by XORing the verification code with the first 32 bytes of each
   encrypted block. Also passes VolumeID in the block upload request.

2. Ghost file rollback on upload failure:
   When block upload fails (step 2) or revision commit fails (step 3),
   the draft link is now permanently deleted via DeleteChildren to
   prevent ghost entries that block future uploads with the same
   filename. Also handles corrupted active links in
   handleRevisionConflict by deleting them when replace_existing_draft
   is enabled.

Depends on: rclone/go-proton-api#<PR> (verification endpoint support)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant