PromptInput rejects every file when accept lists file extensions (".xlsx")
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 83/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- react, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Đọc packages/elements/src/prompt-input.tsx, đặc biệt là matchesAccept quanh các dòng 555–576, nơi các mẫu accept được so sánh. Kiểm tra việc tái hiện issue bằng một tệp .xlsx có kiểu rỗng và hành vi lọc tệp hiện có đối với các mẫu MIME. Được xem là hoàn tất khi các giá trị accept dựa trên phần mở rộng cho phép các tệp khớp được thông qua add, thao tác dán và thả, mà không làm hỏng việc lọc theo kiểu MIME.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
PromptInput passes accept to its hidden file input, where extension entries like .xlsx or .csv are valid. The filter that runs afterwards (matchesAccept) only understands type/* and exact MIME types, so an extension entry never matches. With accept=".xlsx" the file dialog offers the spreadsheet, then add rejects it: onError fires with code: "accept" ("No files match the accepted types."), or nothing happens without onError. Paste and drop use the same filter.
I use extensions because the browser often reports an empty or generic type ("" or application/octet-stream) for .md, .csv or Office files, depending on the OS.
Repro (registry main 6a9d5b1, Chrome):
const file = new File(["sheet"], "report.xlsx", { type: "" });
const AddButton = () => {
const attachments = usePromptInputAttachments();
return (
<button onClick={() => attachments.add([file])} type="button">
Add
</button>
);
};
<PromptInput accept=".xlsx" onError={console.log} onSubmit={() => {}}>
<PromptInputBody>
<AddButton />
<PromptInputTextarea />
</PromptInputBody>
</PromptInput>;
Expected: the file is added, as the native accept attribute allows it.
Actual: onError is called with { code: "accept" } and nothing is added.
Cause: prompt-input.tsx#L555-L576 compares every pattern that does not end in /* with f.type, and a pattern starting with "." never equals a MIME type. It came in with #279, which replaced the old fallback that returned true for anything except image/*.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.5k
- Fork
- 290
- Merge trung bình
- 20 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của vercel/ai-elements
-
PromptInput: successful async submit clears text typed while the submit was pendingCó thể đã có người làm @NicolasMilliard đã nhận 12 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
vercel/ai-elements#518 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Attachments: remove button stays invisible on keyboard focus and on touch screensCó thể đã có người làm @HardMax71 đã nhận 29 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
vercel/ai-elements#507 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ChainOfThought: the header's aria-controls points at an element that is never renderedCó thể đã có người làm @HardMax71 đã nhận 29 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
vercel/ai-elements#505 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Context: ContextReasoningUsage and ContextCacheUsage don't compile with ai 7Có thể đã có người làm @burrows99 đã nhận 19 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
vercel/ai-elements#500 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
vercel/ai-elements#498 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của vercel/ai-elements
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Northeastern-Electric-Racing/FinishLine#4660 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
excaliburjs/Excalibur#3895 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
infer_audio_type only recognises one MPEG Layer III frame header, so most MP3 files are rejectedCó thể đã có người làm @Steve-20-ai đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Earn report crashes with "RangeError: Invalid time value" when a report row has an unparsable timestampCó thể đã có người làm @Gurkaran18 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
joinmarket-webui/jam#1588 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
BeOS .json missingĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mihaip/infinite-mac#475 ·