Skip to content

Commit 0c1e55c

Browse files
committed
server: Prevent default action on file paste
1 parent 9fe3fab commit 0c1e55c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

tools/server/public/index.html.gz

1 Byte
Binary file not shown.

tools/server/webui/src/components/ChatScreen.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,15 @@ function ChatInput({
329329
<div
330330
className="flex flex-col rounded-xl border-1 border-base-content/30 p-3 w-full"
331331
onPasteCapture={(e: ClipboardEvent<HTMLInputElement>) => {
332-
Array.from(e.clipboardData.items)
332+
const files = Array.from(e.clipboardData.items)
333333
.filter((item) => item.kind === 'file')
334334
.map((item) => item.getAsFile())
335-
.forEach((file) => {
336-
if (file) {
337-
extraContext.onFileAdded([file]);
338-
}
339-
});
335+
.filter((file) => file !== null)
336+
337+
if (files.length > 0) {
338+
e.preventDefault();
339+
extraContext.onFileAdded(files);
340+
}
340341
}}
341342
{...getRootProps()}
342343
>

0 commit comments

Comments
 (0)