desktop: pasted image breaks and send fails with "Failed to fetch" after the clipboard temp file is deleted

オープン 初心者向け
#62,052 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
desktop-dev, typescript
領域
desktop

調査の方向性

まず packages/app/src/runtime/persistence/drafts.ts を読み、特に putBlob と createBlobReference を確認します。次に、貼り付けた画像のバイト列がどのように保存されるか、またプレビューと blobDataUrl が元の File をどのように使うかを追います。前の一時ファイルを削除するクリップボードソースから画像を2枚貼り付けて再現します。そのファイルを削除した後も最初のサムネイルが表示され、送信が成功すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

reproduced
Description

Pasting an image that the clipboard hands over as a temp file (on Windows, WeType / 微信输入法 keeps clipboard images in %LOCALAPPDATA%Low\Tencent\WeType\ClipboardTmp and deletes the previous one on every new copy) works at first. Once that temp file is gone, the thumbnail turns into a broken image and sending fails with "Failed to fetch". Pasting two images in a row is enough: the first one always breaks.

The bytes are already saved to the draft store on paste, but the preview and blobDataUrl still read the original File. Chromium reads a disk-backed File lazily, so the send goes back to the deleted file. I checked this in plain Chromium: once the file is deleted, fetch(URL.createObjectURL(file)) throws TypeError: Failed to fetch and an <img> with that URL fails to load. An in-memory copy of the same bytes keeps working.

Plugins

none relevant

OpenCode version

Desktop 1.19.5. The same code path is on dev (packages/app/src/runtime/persistence/drafts.ts, putBlob / createBlobReference)

Steps to reproduce
  1. On Windows with WeType's clipboard enabled, copy image A and paste it into the prompt.
  2. Copy image B. WeType deletes A's temp file. Paste B.
  3. A's thumbnail is now broken. Press send and you get "发送提示失败 / Failed to fetch".
Screenshot

No response

Operating System

Windows 10 Pro 22H2

Terminal

n/a (desktop app)

主要言語
TypeScript
スター
224k
フォーク
30k
平均マージ
6時間 16分
マージ済み PR(30日)
507

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。