-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allowedFileExtensions and fileKinds not synced #3917
Comments
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. |
Description
The asset field in the CMS comes with preset file types, but the extensions for these types aren't all allowed by default:
fileKinds
allowedFileExtensions
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
allowedFileExtensions
. JSON was like this and fixed in #3254, but there's still many differences between the two extension sets. Some entirefileKinds
like Access and PHP don't have any of their extensions inallowedFileExtensions
.I also think it could be handy to be able to define
fileKinds
from scratch. For example, I might not want so manyfileKinds
to choose from when making an assets field. e.g. I'll likely never need uploadable Access, Illustrator, Photoshop files, so I might want to remove them. Or, I might want to combine or split some of the built-infileKinds
(e.g. maybe "Code"fileKind
that covers PHP, JS, and HTML, or split "Image" into "Photo/Raster" and "Illustration/Vector").Is there a reason why the built-in
fileKinds
are hard-coded and extendable withextraFileKinds
rather than having a default value that can be overwritten likeallowedFileExtensions
?Related: #3254 #3131
Steps to reproduce
n/a
Additional info
The text was updated successfully, but these errors were encountered: