Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This came up in #2458377: Upload .svg files , that if I add a mime type to one of my file types, I shouldn't have to go to /admin/config/media/file-settings and add the appropriate extension there in order to upload a file to /file/add. I think we should instead auto-generate the allowed upload extensions based on our file types.
Comments
Comment #1
Dave ReidComment #2
Dave ReidBefore:
After:
Comment #3
Dave ReidComment #4
Dave ReidThis one changes up the default file types to be a little more restrictive and not wildcard all the audio, image, and video file types.
Updated view of file/add with the updated file types:
Comment #6
Dave ReidForgot to add video/mpeg to the video file type to cover the 'mpeg' extension.
Comment #8
Dave ReidFixed tests.
Comment #9
seanBThe patch seemed to work, but I was missing something when using the upload form in the media browser. The types added in $options['types'] were not being used. I added a check for this. Please let me know if this is something that you would consider adding.
I created this patch against the latest dev.
Comment #10
TwoDThe patch in #9 is working well for me, using it together with #2533352-1: Rethink allowed extensions on field instance to not have to think about individual extensions again!
Comment #11
kristofferwiklund CreditAttribution: kristofferwiklund at Websystem commentedWe have had the patch in #9 running for month now without any problems.
Comment #13
TwoDThis should not have been failed...
Patch still applies cleanly.
Comment #14
joseph.olstadstraightup reroll of patch 9
Comment #15
joseph.olstadthis was pushed into file_entity 7.x-3.x
however, I'm testing a patch to Media to allow 7.x-2.x-dev or 7-x-3.x-dev , the requirements phase needs to check to see for 2.0 or newer but was recently preventing dev branch releases so making a change in Media to allow dev branches and newer dev branches like 7.x-3.x
if you want to test this, download file_entity 7.x-3.x dev
then Media 7.x-2.10 or newer or Media 7.x-3.0-beta4 and then apply this media patch:
#2902804-7: change file_entity requirements in Media to allow dev releases including new file_entity 3.x
Comment #16
joseph.olstadsetting back to 7.x-2.x branch
Comment #18
joseph.olstadComment #22
joseph.olstadI reverted this change as it appears to cause problems with the media module tests for media_internet.
Comment #24
joseph.olstadthis patch conflicts with media_internet (causes failures in the media_internet tests) , a sub module of media, before committing this patch, make sure to run the full media tests in the testing tool.