summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFilip <[email protected]>2026-01-19 21:16:25 +0100
committerGitHub <[email protected]>2026-01-19 14:16:25 -0600
commitc3393ecc6c0a1482669b945e109af1d98f25a5ee (patch)
tree430529b1a2db795f79a3207427a12abd79d61282
parent889c60d63b585a276080f20c40c2d73ff715ea94 (diff)
downloadopencode-c3393ecc6c0a1482669b945e109af1d98f25a5ee.tar.gz
opencode-c3393ecc6c0a1482669b945e109af1d98f25a5ee.zip
fix(app): give feedback when trying to paste a unsupported filetype (#9452)
-rw-r--r--packages/app/src/components/prompt-input.tsx12
1 files changed, 11 insertions, 1 deletions
diff --git a/packages/app/src/components/prompt-input.tsx b/packages/app/src/components/prompt-input.tsx
index c74edd94e..56bbdc8cb 100644
--- a/packages/app/src/components/prompt-input.tsx
+++ b/packages/app/src/components/prompt-input.tsx
@@ -300,7 +300,8 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
event.stopPropagation()
const items = Array.from(clipboardData.items)
- const imageItems = items.filter((item) => ACCEPTED_FILE_TYPES.includes(item.type))
+ const fileItems = items.filter((item) => item.kind === "file")
+ const imageItems = fileItems.filter((item) => ACCEPTED_FILE_TYPES.includes(item.type))
if (imageItems.length > 0) {
for (const item of imageItems) {
@@ -310,7 +311,16 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
return
}
+ if (fileItems.length > 0) {
+ showToast({
+ title: "Unsupported paste",
+ description: "Only images or PDFs can be pasted here.",
+ })
+ return
+ }
+
const plainText = clipboardData.getData("text/plain") ?? ""
+ if (!plainText) return
addPart({ type: "text", content: plainText, start: 0, end: 0 })
}