Skip to content

feat: add ContentHash and KeyAuthor fields for move/rename support#4

Open
mcanevet wants to merge 2 commits intorclone:masterfrom
mcanevet:lmwashere/master
Open

feat: add ContentHash and KeyAuthor fields for move/rename support#4
mcanevet wants to merge 2 commits intorclone:masterfrom
mcanevet:lmwashere/master

Conversation

@mcanevet
Copy link
Copy Markdown

@mcanevet mcanevet commented Mar 13, 2026

Summary

Add ContentHash and KeyAuthor fields to fix Code 2000 errors during move/rename operations.

Changes

  • Add ContentHash *string field to MoveLinkReq (nil serializes as JSON null)
  • Add KeyAuthor *string field to Link struct (for anonymous node detection)

Why

These changes fix Code 2000 errors during move/rename operations by:

  1. Allowing explicit null ContentHash to be sent for file moves
  2. Allowing detection of anonymous vs non-anonymous nodes

Test Results

With the companion Proton-API-Bridge fix:

  • FsMove: PASS (was failing with Code 2000)
  • FsDirMove: PASS (was failing with Code 2000)
  • All other tests: PASS

See also: rclone/Proton-API-Bridge#3

Josh Miller and others added 2 commits February 25, 2026 08:14
…oint

Proton's storage backend now requires a Verifier.Token per block when
requesting block upload URLs (POST /drive/blocks). Without it, the storage
server rejects uploads with HTTP 422 / Code=200501 "Operation failed:
Please retry".

This commit adds:

- RevisionVerification type and BlockUploadVerifier type in block_types.go
- Verifier field (omitempty) on BlockUploadInfo
- GetRevisionVerification() method calling the v2 API endpoint:
  GET /drive/v2/volumes/{volumeID}/links/{linkID}/revisions/{revisionID}/verification

The VerificationCode returned by that endpoint is XOR'd with the leading
bytes of each block's ciphertext in Proton-API-Bridge to produce the
per-block token (matching the algorithm in the official Proton Drive JS SDK).

Note: the JS SDK also decrypts each block as a client-side integrity check
before computing the XOR. That step is not implemented here; the server-side
manifest signature still provides end-to-end integrity verification.

This fix was identified and generated with Claude Code (AI assistant) by a
non-programmer user. It has not been independently reviewed by a Go or
cryptography expert. Expert review before merging is strongly recommended.

Fixes uploads failing with: 422 POST fra-storage.proton.me/storage/blocks:
Operation failed: Please retry (Code=200501, Status=422)
- Add ContentHash *string field to MoveLinkReq (nil serializes as JSON null)
- Add KeyAuthor *string field to Link struct (for anonymous node detection)

These changes fix Code 2000 errors during move/rename operations by:
1. Allowing explicit null ContentHash to be sent for file moves
2. Allowing detection of anonymous vs non-anonymous nodes
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