Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/small-deer-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ai-elements": patch
---

Handle non image file types in matchesAccept filter
18 changes: 13 additions & 5 deletions packages/elements/src/prompt-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,19 @@ export const PromptInput = ({
if (!accept || accept.trim() === "") {
return true;
}
if (accept.includes("image/*")) {
return f.type.startsWith("image/");
}
// NOTE: keep simple; expand as needed
return true;

const patterns = accept
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉 great update - on that note, as AI Elements grows, shall we also include unit tests for such changes?

I haven't had much time in the last few weeks, but would be happy to help on this between the years!

Copy link
Member

@haydenbleasel haydenbleasel Dec 8, 2025

Choose a reason for hiding this comment

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

Definitely, I'll add the unit tests myself but we should start asking for them to be part of the PR 😂

.split(",")
.map((s) => s.trim())
.filter(Boolean);

return patterns.some((pattern) => {
if (pattern.endsWith("/*")) {
const prefix = pattern.slice(0, -1); // e.g: image/* -> image/
return f.type.startsWith(prefix);
}
return f.type === pattern;
});
},
[accept]
);
Expand Down