Skip to content

Attachment that grows past maxAttachmentSizeKB is silently overwritten by the stale remote copy #75

Description

@Mokson

Version: plugin 2.1.1, server 0.3.0

Summary
When a local attachment grows beyond maxAttachmentSizeKB, the next authoritative reconcile replaces it on disk with the older remote bytes. No conflict artifact, no Notice.

Path (tag 2.1.1)

  1. src/sync/blobSync.ts:661 - the reconcile size filter drops the oversized file from diskBlobs, but its path remains in crdtBlobPaths.
  2. src/sync/blobSync.ts:704-713 - the "CRDT blob not on disk" branch schedules a download for a path that is on disk.
  3. src/sync/blobSync.ts:876 - processUpload skips the file by size, so the newer local bytes never reach the server.
  4. src/sync/blobSync.ts:1234 - processDownload sees diskHash !== item.hash, re-hashes, finds no change during the download, and takes the overwrite-existing branch via modifyBinary.

Related

  • src/runtime/capabilityUpdateService.ts:505-514 clamps maxAttachmentSizeKB down to the server's maxBlobUploadBytes and persists it with only a debug log, so a server-side cap reduction pushes every attachment above the new cap into this path.
  • Oversized attachments are not counted in reconcile's skipped and produce no Notice (unlike oversized notes at reconciliationController.ts:552), which is why the overwrite is invisible with debug off.

Repro

  1. Two devices in sync, attachment a.png at 1 MB.
  2. On device A, replace a.png with a 12 MB file (cap 10240 KB).
  3. Restart Obsidian on device A (or trigger a reconnect reconcile).
  4. a.png on device A is back to the 1 MB remote copy. The 12 MB file is gone.

Expected
Oversized local attachments are excluded from download as well as upload, or preserved via a conflict artifact, and surfaced with a Notice like oversized notes.

Tests
tests/client/blob-download-conflicts.ts covers race and mismatch quarantine; nothing exercises the size-limit path.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions