Repository navigation
fix(files): send file content, not a temporary blob: URL, on save - #83
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by הדסה · project thread
Fixes buzz-code/ops#72
Problem
CommonFileInputconverts a newly picked file to base64 in an asyncuseEffect. Until that finishes, the form value'ssrcis ablob:URL, which is valid only inside the current tab. Saving before the conversion completes stores theblob:URL, so the file cannot be opened later.Fix
utils/pendingFiles.util.tsresolvePendingFiles(data): walks the payload and replaces any{ src: 'blob:…', rawFile: Blob }with its data URL.baseDataProvidercreateandupdateawait it before sending, so the race cannot happen no matter how fast Save is clicked. The existinguseEffectstays (it still feeds the preview).Tests
utils/__tests__/pendingFiles.util.test.ts(new)baseDataProvider.test.ts: create/update send the data URL instead ofblob:.Purely additive, no consumer action needed (no CONSUMER_CHANGES row).
Generated by Claude Code