Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

harden chat attachment loading#168

Merged
tulsi-builder merged 2 commits intomainfrom
tulsi/file-drag-drop-followup
Apr 13, 2026
Merged

harden chat attachment loading#168
tulsi-builder merged 2 commits intomainfrom
tulsi/file-drag-drop-followup

Conversation

@tulsi-builder
Copy link
Copy Markdown
Collaborator

Category: fix
User Impact: Users get more reliable file and image attachment handling in desktop chat, especially when selecting files from the attach button or attaching large images.
Problem: The original attachment work still had a few rough edges after merge: picker-based attachment loading could fail outside the dialog try path, attachment dedupe flattened case distinctions, and path-based image reads could load arbitrarily large files into memory before encoding them.
Solution: This follow-up keeps the picker flow inside the existing async error boundary, preserves native path casing during dedupe, and adds a hard size cap before base64-encoding local image attachments. The change stays within the existing desktop attachment surfaces so it’s straightforward to port forward if the repo migration lands first.

File changes

scripts/check-file-sizes.mjs
Raised the existing system.rs exception slightly to account for the added attachment hardening and regression tests in the same Tauri command surface.

src-tauri/src/commands/system.rs
Added a 20 MB guard before path-based image encoding, preserved case-sensitive path dedupe semantics, and covered both behaviors with focused Rust tests.

src/features/chat/hooks/useChatInputAttachments.ts
Stopped lowercasing attachment paths during frontend dedupe so path identity matches the underlying filesystem semantics.

src/features/chat/ui/ChatInput.tsx
Awaited attach-button path loading inside the dialog try blocks so async attachment failures stay inside the intended error handling path.

Reproduction Steps

  1. Open the desktop app and start a new chat.
  2. Use the attach button to choose a file or folder and confirm the attachment appears in the composer without silently failing.
  3. Attach two distinct paths that differ only by case on a case-sensitive filesystem and confirm both can be represented.
  4. Try attaching an extremely large local image from the file picker or drag-and-drop path and confirm the app rejects it instead of attempting to encode and send it.
  5. Run the existing attachment flows again to confirm normal file, folder, and image attachments still work.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b5a908ebc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/features/chat/hooks/useChatInputAttachments.ts
Comment thread src-tauri/src/commands/system.rs
@tulsi-builder tulsi-builder merged commit da6b22b into main Apr 13, 2026
8 checks passed
@tulsi-builder tulsi-builder deleted the tulsi/file-drag-drop-followup branch April 13, 2026 21:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant