Skip to content

Conversation

@J-Michalek
Copy link
Contributor

πŸ”— Linked issue

Resolves: #4638

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

The FileUpload component now works with wildcard accept attributes such as image/*.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

The accept prop did not work with image/* etc.
The accept prop did not work with image/* etc.
@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 6, 2025

npm i https://pkg.pr.new/@nuxt/ui@4671

commit: 6952c39

Copy link
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

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

@J-Michalek I'm not sure to understand your changes here, I think this should be enough:

--- a/src/runtime/composables/useFileUpload.ts
+++ b/src/runtime/composables/useFileUpload.ts
@@ -26,6 +26,12 @@ function parseAcceptToDataTypes(accept: string): string[] | undefined {
     .filter((type) => {
       return !type.startsWith('.')
     })
+    .map((type) => {
+      if (type.includes('/') && type.endsWith('/*')) {
+        return type.split('/')[0] || type
+      }
+      return type
+    })
 
   return types.length > 0 ? types : undefined
 }

@J-Michalek
Copy link
Contributor Author

I probably overcooked it, your implementation seems to work just as well while being easier to digest. I've pushed the changes.

@benjamincanac benjamincanac changed the title fix(FileUpload): dataTypes not working with wildcard accept prop fix(FileUpload): dropzone dataTypes with wildcard accept Aug 11, 2025
@benjamincanac benjamincanac changed the title fix(FileUpload): dropzone dataTypes with wildcard accept fix(FileUpload): handle wildcard in dropzone dataTypes Aug 11, 2025
@benjamincanac benjamincanac merged commit 729bed4 into nuxt:v3 Aug 11, 2025
6 checks passed
@benjamincanac benjamincanac added the v3 #1289 label Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3 #1289

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No dropzone in FileUpload

2 participants