Skip to content

fix(files): send file content, not a temporary blob: URL, on save - #83

Merged
buzz-code merged 1 commit into
mainfrom
claude/project-thread-5fteae
Nov 17, 2026
Merged

buzz-code merged 1 commit into
mainfrom
claude/project-thread-5fteae

Conversation

@buzz-code

Copy link
Copy Markdown
Owner

Requested by הדסה · project thread

Fixes buzz-code/ops#72

Problem

CommonFileInput converts a newly picked file to base64 in an async useEffect. Until that finishes, the form value's src is a blob: URL, which is valid only inside the current tab. Saving before the conversion completes stores the blob: URL, so the file cannot be opened later.

Fix

  • New utils/pendingFiles.util.ts resolvePendingFiles(data): walks the payload and replaces any { src: 'blob:…', rawFile: Blob } with its data URL.
  • baseDataProvider create and update await it before sending, so the race cannot happen no matter how fast Save is clicked. The existing useEffect stays (it still feeds the preview).

Tests

  • utils/__tests__/pendingFiles.util.test.ts (new)
  • baseDataProvider.test.ts: create/update send the data URL instead of blob:.
  • Full suite: 40 passed, 1 skipped.

Purely additive, no consumer action needed (no CONSUMER_CHANGES row).


Generated by Claude Code

FileInput keeps a blob: src until the async base64 read finishes, so a
fast save could store the blob: URL and lose the file. The data provider
now resolves any pending file to its data URL in create/update before
sending.

Fixes buzz-code/ops#72

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012GTicqUJeC3ZKmNLvMo6hy
@buzz-code
buzz-code merged commit 42be8fd into main Nov 17, 2026
1 check passed
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.

2 participants