Bug with file type options.accept causing desk tool to crash in Sanity v3

4 replies
Last updated: May 31, 2023
[Sanity v3 bug?] File type options.accept: when I click the “Browse” button, the desk tool crashed with error: “*Error: accept.split is not a function*”. The error goes away when I remove the options.accept.
Schema:


{

name: "document",

type: "file",

title: "Document",

options: {

accept: [

"application/pdf",

],

},

}

My previous Sanity v2 projects are fine.

Does anyone know how to get it resolved? Thanks.
May 25, 2023, 9:17 PM
I think ‘accept’ expects a string not an array of strings
May 25, 2023, 9:20 PM
Thank you. Weird that I had it wrong in my previous projects.
May 25, 2023, 9:24 PM
user N
I could be wrong, but I believe both were handled in v2 (a string or an array of strings), but in v3 we tightened it up to align with what was documented (i.e., only a string). So I don’t think it’s that you were wrong before, but perhaps that we didn’t enforce it.
May 31, 2023, 8:26 PM
That makes sense. Thanks
user A
!!
May 31, 2023, 8:32 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?