Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
allowedFileExtensions and fileKinds not synced #3917
The asset field in the CMS comes with preset file types, but the extensions for these types aren't all allowed by default:
It's kind of weird that you can select a file type to be allowed in the CMS, but they can't actually be uploaded since those extensions don't match up with
I also think it could be handy to be able to define
Is there a reason why the built-in
Steps to reproduce
Agree that’s awkward. Maybe we can limit the asset setting to only show file kinds that contain uploadable file extensions.
Doesn’t make a ton of sense to make the whole thing customizable, since it’s not like a
Yes, I think this should be done, at least.
Even with the pre-set "audio" file kind, though... It's true all those file extensions are for audio files, but if I'm using the audio file as the source for a front-end HTML5 audio player, for cross-browser support I probably want content authors to only be able to upload MP3, FLAC, and WAV files (unless I'm converting file types in the backend anyways).
Currently, I would have to make a new file kind for web audio only, or disallow the unwanted file extensions for the whole site. I guess that's fine for the most part?
It still seems a bit weird for me to have file kinds and file extensions managed separately, since fileKinds already contains file extensions which could be used as the value for allowableFileExtensions?
If I add a new file kind, I have update
Added that change to Assets fields for the next release.
Yep, you could define a “Web Audio” file kind using the
Well, the full list of file kinds is mainly for Craft’s own reference. Similar to knowing all the MIME types, even if there’s types in there that aren’t actually allowed to be uploaded. There could be other cases unrelated to uploading where Craft needs to know what type of file something is. (Even with assets – it’s possible to circumvent the
Yeah good call. Added a tip about this to the extraFileKinds config setting docs.