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

Đang mở Phù hợp với người mới
#62,052 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
74/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
desktop-dev, typescript
Lĩnh vực
desktop

Hướng nghiên cứu

Bắt đầu bằng cách đọc packages/app/src/runtime/persistence/drafts.ts, đặc biệt là putBlob và createBlobReference, rồi theo dõi cách dữ liệu byte của ảnh được dán được lưu trữ và cách bản xem trước cùng blobDataUrl sử dụng File gốc. Tái hiện bằng cách dán hai ảnh từ một nguồn clipboard xóa tệp tạm trước đó; hoàn tất khi hình thu nhỏ đầu tiên vẫn hiển thị và gửi thành công sau khi tệp đó bị xóa.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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)

Ngôn ngữ chính
TypeScript
Star
224k
Fork
30k
Merge trung bình
6 giờ 16 phút
Pull request đã merge (30 ngày)
507

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode

Tất cả issue của anomalyco/opencode

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.