Skip to content

bug(desktop): pasting a Finder folder stages it as a file and makes send fail #5279

Description

@myxtype

What happened

On macOS, copying a directory in Finder and pasting it into the Desktop composer creates a normal file-attachment chip. The chip looks sendable, but submitting the message fails with the generic send-failure toast ("Failed to send" / "Please try again").

Expected behavior: a pasted directory should either become the existing Host-bound folder reference used by Reference folder, or be rejected during paste with a clear localized explanation. It must not be staged as a normal file attachment that can only fail during submission.

This should not recursively upload or eagerly enumerate the directory.

How to reproduce

  1. Open Maka Desktop and an agent session with no turn running.
  2. In macOS Finder, select a folder and press Cmd+C.
  3. Focus the Desktop composer and press Cmd+V.
  4. Observe that the folder appears as a normal file attachment.
  5. Enter any text if needed and click Send.
  6. Observe that submission fails with the generic send-failure toast.

Environment

  • Maka version or commit: observed in a downstream Desktop build at 3fe9ec9; source inspection confirms the same path is still present in upstream main at f109ccde9
  • OS and version: Darwin 25.6.0 (macOS, arm64)
  • Surface: Desktop
  • Electron: 43.4.1
  • Chrome: 150.0.7871.224
  • Node.js: 24.18.1
  • Locale: zh-CN

Logs, screenshots, or additional context

The visible toast is:

  • Title: 发送失败
  • Description: 消息暂时无法发送,请稍后重试。

The diagnostic report does not include the underlying renderer/preload exception. The source path explains why the folder first appears valid and only fails at send time:

  • packages/ui/src/composer.tsx: onInputFiles forwards every clipboard File to onAttachFilePaths without distinguishing a directory.
  • packages/ui/src/use-composer-attachments.ts: sniffFileMimeType catches a failed file.slice(...).arrayBuffer() read and still stages the item as an attachment.
  • apps/desktop/src/renderer/attachment-preflight.ts: preflight checks only count and byte size, so a directory-shaped File is not rejected.
  • apps/desktop/src/preload/attachment-ingest-payload.ts: submission later calls file.arrayBuffer() without mapping an unreadable/directory source to an expected attachment error, so the exception falls through to the generic send failure.

Related but not duplicate:

A focused regression test could paste a directory-shaped clipboard item and assert that it is never staged as an ordinary attachment or allowed to reach encodeIngestItems as a file.

AI assistance: OpenAI Codex inspected the source paths, searched existing Issues and PRs, and drafted this report.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions