AstrBot-Desktop/src-tauri/src
YokiiroBW 0b4a7de62a
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
fix(astrbot): resolve an attachment's type from its bytes when needed
An attachment downloaded and then rendered as a broken image. A blob URL
is decoded according to the blob's type, so handing the webview
application/octet-stream makes img refuse bytes that are a perfectly
good PNG — and octet-stream is exactly what the client substitutes when
the server names no type.

Prefer a concrete image type from the server, otherwise identify the
format from its leading bytes. Every signature checked is a fixed marker
at a fixed offset, so this reads no user content, and a JSON error body
served with HTTP 200 is deliberately not mistaken for an image.

Whether that was the cause is not yet established, so the alternative is
made self-diagnosing rather than guessed at. The download outcome —
status, the type the server gave, the type the bytes indicate, and the
length — is now traced, and the frontend reports why an attachment did
not render instead of leaving a bare broken-image icon: a failed
download shows its error, and a payload the browser cannot decode says
so. Both paths were previously swallowed.

Refs: N-6.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 02:29:33 +08:00
..
credentials feat(pet): separate remote identity and add paper pet window 2026-07-20 16:28:42 +08:00
database feat(desktop): complete Q9 chat and stability increment 2026-07-21 14:43:14 +08:00
diagnostics feat(desktop): complete Q9 chat and stability increment 2026-07-21 14:43:14 +08:00
file_transfer feat(p00): add Tauri desktop spike foundation 2026-07-18 20:34:47 +08:00
networking fix(astrbot): resolve an attachment's type from its bytes when needed 2026-07-27 02:29:33 +08:00
secure_store feat(chat): add AstrBot dual-slot chat foundation 2026-07-20 11:31:41 +08:00
windows feat(desktop): complete Q9 chat and stability increment 2026-07-21 14:43:14 +08:00
auth.rs feat(auth): add dashboard jwt login 2026-07-20 16:12:11 +08:00
lib.rs fix(chat): prevent duplicate history on session switch 2026-07-22 02:52:31 +08:00
logging.rs feat(foundation): add persistent bootstrap safeguards 2026-07-18 22:17:29 +08:00
main.rs feat(p00): add Tauri desktop spike foundation 2026-07-18 20:34:47 +08:00
pet.rs feat(chat): add AstrBot dual-slot chat foundation 2026-07-20 11:31:41 +08:00
policy.rs feat(pet): separate remote identity and add paper pet window 2026-07-20 16:28:42 +08:00
profiles.rs feat(pet): separate remote identity and add paper pet window 2026-07-20 16:28:42 +08:00
quick_window.rs feat(window): persist quick chat geometry 2026-07-20 14:59:55 +08:00
runtime_guards.rs feat(connection): validate auto-connect and guard operations switches 2026-07-20 00:49:15 +08:00
slots.rs feat(pet): separate remote identity and add paper pet window 2026-07-20 16:28:42 +08:00