Skip to content

Commit

Permalink
fix(core): updates to not show "cannot upload" on hover when using ex…
Browse files Browse the repository at this point in the history
…tension based accepts settings (#5881)
  • Loading branch information
jtpetty authored Mar 1, 2024
1 parent 7ed2b0f commit 023e7e6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/sanity/src/core/form/studio/uploads/accepts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ export function accepts(file: FileLike, acceptedFiles: string | string[]): boole
const validType = type.trim().toLowerCase()

if (validType.charAt(0) === '.') {
return fileName.toLowerCase().endsWith(validType)
if (fileName) {
return fileName.toLowerCase().endsWith(validType)
}
// If we do not have a valid fileName and validType is an extension, we
// should fail open. This happens because when hovering a file, the browser
// does not pass the name of the file but it will pass the file name when the
// file is dropped on the file upload input
return true
}

if (validType.endsWith('/*')) {
Expand Down

0 comments on commit 023e7e6

Please sign in to comment.