Skip to content
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

[Suggestion] Add type declaration for (extra)AllowedFileExtensions etc #3131

Closed
billythekid opened this issue Jul 23, 2018 · 2 comments
Closed
Labels
assets 📁 features related to asset management enhancement improvements to existing features

Comments

@billythekid
Copy link
Contributor

billythekid commented Jul 23, 2018

When you add a file extension to the allowed uploads/assets but output {{ file.type }} it can return 'undefined'. I propose that the config setting for allowedFileExtensions and extraAllowedFileExtensions be in the format ['extension'=>'type', … ] where type is optional or make it an array of tuples [['ext','type'],['ext,'type']], whatever implementation you like for backwards compatibility.

for example…

// key=>val style
'extraAllowedFileExtensions' => [
    'pub' => 'publisher', 
    'bz'  => 'compressed'
]

// tuple-style
'extraAllowedFileExtensions' => [
    ['pub', 'publisher'], 
    ['bz', 'compressed'],
]

perhaps this can be extended to include mimetypes too to add to Yii's getMimeTypeByExtension helper that it looks like Craft uses. (Which just maps pre-set values anyway)

@brandonkelly brandonkelly added enhancement improvements to existing features assets 📁 features related to asset management labels Jul 24, 2018
@missmatsuko
Copy link
Contributor

I think you can do this now with extraFileKinds.
https://docs.craftcms.com/v3/config/config-settings.html#extrafilekinds

@brandonkelly
Copy link
Member

brandonkelly commented Feb 26, 2019

Yep! Added in 3.0.37. (e1d9433)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assets 📁 features related to asset management enhancement improvements to existing features
Projects
None yet
Development

No branches or pull requests

3 participants