You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Web: image attachments fail on insecure origins; no client-side optimization #46419
Attaching an image in the web app is unreliable, especially over remote/slow or insecure connections:
Large photos upload as full-size payloads, and HEIC/HEIF are not accepted by the picker or readable by the vision model.
On an insecure (http) origin, crypto.subtle is undefined, so blob ID generation throws and the attachment silently never gets added to the prompt.
Expected
Attach a JPG/PNG/HEIC and have it appear in the prompt reliably, with a reasonably-sized payload.
Actual
Blob reference creation fails on insecure origins (TypeError: ... digest).
Large images are sent un-optimized; HEIC/HEIF are unsupported.
Suggested fix
Downscale/re-encode images client-side (HEIC/WebP/JPEG → JPEG, PNG kept, capped at 1920px / quality 0.82) with a short timeout fallback to the original.
Fall back to crypto.getRandomValues when crypto.subtle is unavailable.
On the crypto.subtle part: in current v2 the draft blob ID code (packages/app/src/runtime/persistence/drafts.ts, which replaced draft-store.ts) already falls back to crypto.getRandomValues when crypto.subtle is unavailable, so attachments shouldn't fail that way on insecure origins anymore. If you still see the digest TypeError on a recent v2 release, please reply with your opencode --version and the browser you used.
The rest is a feature request: the web app should downscale and re-encode large image attachments on the client (for example, cap at 1920px and convert HEIC/WebP/JPEG to JPEG), and should accept HEIC/HEIF in the picker. Today the app sends images as they are and doesn't support HEIC. Maintainers will consider it.
Activity
github-actions commentedon Aug 31, 2026
This issue might be a duplicate of existing issues. Please check:
crypto.randomUUID/crypto.subtleunavailable in insecure HTTP contexts (non-localhost origins), causing file attachment to silently fail in the Web UI. That issue also covers session delete and drag-drop attach, and notes the existinguuid()fallback util inpackages/app/src/utils/uuid.ts.opencodejr commentedon Oct 28, 2026
Thanks for the detailed write-up!
On the
crypto.subtlepart: in current v2 the draft blob ID code (packages/app/src/runtime/persistence/drafts.ts, which replaceddraft-store.ts) already falls back tocrypto.getRandomValueswhencrypto.subtleis unavailable, so attachments shouldn't fail that way on insecure origins anymore. If you still see thedigestTypeError on a recent v2 release, please reply with youropencode --versionand the browser you used.The rest is a feature request: the web app should downscale and re-encode large image attachments on the client (for example, cap at 1920px and convert HEIC/WebP/JPEG to JPEG), and should accept HEIC/HEIF in the picker. Today the app sends images as they are and doesn't support HEIC. Maintainers will consider it.
Related:
crypto.randomUUIDat other call sites)