Commit 86b97da
committed
fix(opencode): validate clipboard content type on Linux
On Linux, xclip/wl-paste output raw bytes even when clipboard contains
text (not an image). The code only checked byteLength > 0, so text was
incorrectly labeled as image/png and sent to the model, which failed
with 'could not process image'.
Use existing sniffAttachmentMime() to validate PNG magic bytes before
returning clipboard content as an image.
Fixes #234581 parent 16caaa2 commit 86b97da
1 file changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
96 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
101 | 105 | | |
102 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
103 | 110 | | |
104 | 111 | | |
105 | 112 | | |
| |||
0 commit comments