Repository navigation
fix(app): support image attachments on insecure origins - #52529
Closed
ChristopheAwad wants to merge 1 commit into
Closed
ChristopheAwad wants to merge 1 commit into
ChristopheAwad wants to merge 1 commit into
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
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.
Issue for this PR
Closes #47645
Type of change
What does this PR do?
Image attach failed on plain http hosts.
crypto.subtleis undefined there, soblobID()threw and the part was dropped. The fix usescrypto.getRandomValueswhensubtle.digestis missing or throws. It also catches a faileddraftStore.putBloband falls back to a local blob reference. Same fallback added to the v2 path insession-ui.Note: the fallback id is random, not a SHA-256 hash. Same file gets a new id on http. Secure contexts still use the hash.
How did you verify your code works?
Ran a personal build and opened the web UI over LAN on plain http from a second machine. Attached an image, the thumbnail appeared, and the model read the text in the image back correctly.
Also added packages/app/test-browser/draft-store-insecure.test.ts with 5 cases: hash path when subtle exists, fallback when subtle is missing, fallback when digest rejects, attach without draft store on insecure context, and empty plus non-image reject. CI runs typecheck and tests.
Screenshots / recordings
No UI change. No screenshot.
Checklist