Skip to content

fix: ignore empty accept entries - #131

Merged
rolandjitsu merged 1 commit into
react-dropzone:mainfrom
feritcemkahraman:fix/ignore-empty-accept-entries
Oct 10, 2026
Merged

rolandjitsu merged 1 commit into
react-dropzone:mainfrom
feritcemkahraman:fix/ignore-empty-accept-entries

Conversation

@feritcemkahraman

Copy link
Copy Markdown
Contributor

A trailing comma or blank array entry can accept an unrelated file whose MIME type is unknown. For example, accept({ name: "document.pdf", type: "" }, ".png,") currently returns true because the empty entry matches the empty MIME type.

Ignore blank entries before matching. If no entries remain, treat the list like the already-supported empty string/empty array and accept any file. Valid extension and MIME matching stays the same.

Validation:

  • Seven new regressions fail before the source fix, covering leading/trailing commas, blank array entries and entirely empty lists.
  • All 17 Vitest tests pass with 100% statement, branch, function and line coverage.
  • Type check, oxlint, type-aware oxlint and repository format check pass.
  • tsdown builds ESM/CJS and declarations; size-limit passes (558 B ESM, 560 B CJS brotlied; 2 kB budget).
  • git diff --check passes.

On Windows, the npm prebuild cleanup (rm -rf) is unavailable, so the same build and size tools were run with npm exec -- tsdown and npm exec -- size-limit. No package scripts or dependencies were changed.

Assisted-by: OpenAI:Codex
@rolandjitsu
rolandjitsu merged commit e6b4f33 into react-dropzone:main Oct 10, 2026
7 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants